// expunge all the registed implementaions
func preTest() {
	cases := []struct {
		name string
		f    snapshot.UpdateServiceSnapshot
	}{
		{"mname0", &UpdateServiceSnapshotMock{}},
		{"mname1", &UpdateServiceSnapshotMock{}},
		{"aname0", &snapshot.UpdateServiceSnapshotAppv1{}},
		{"aname1", &snapshot.UpdateServiceSnapshotAppv1{}},
	}

	snapshot.UnregisterAllSnapshot()

	for _, c := range cases {
		snapshot.RegisterSnapshot(c.name, c.f)
	}
}
func TestRegisterSnapshot(t *testing.T) {
	preTest()

	cases := []struct {
		name     string
		f        snapshot.UpdateServiceSnapshot
		expected bool
	}{
		{"", &UpdateServiceSnapshotMock{}, false},
		{"testsname", nil, false},
		{"testsname", &UpdateServiceSnapshotMock{}, true},
		{"testsname", &UpdateServiceSnapshotMock{}, false},
	}

	for _, c := range cases {
		err := snapshot.RegisterSnapshot(c.name, c.f)
		assert.Equal(t, c.expected, err == nil, "Fail to register snapshot")
	}
}