public void RegistrationListSnapshotUnaffectedUntilFlush() { var registrationList = new XRInteractionManager.RegistrationList <string>(); Assert.That(registrationList.Register("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.True); Assert.That(registrationList.registeredSnapshot, Is.Empty); registrationList.Flush(); Assert.That(registrationList.IsRegistered("A"), Is.True); Assert.That(registrationList.registeredSnapshot, Is.EqualTo(new[] { "A" })); Assert.That(registrationList.Unregister("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.False); Assert.That(registrationList.Register("B"), Is.True); Assert.That(registrationList.IsRegistered("B"), Is.True); Assert.That(registrationList.registeredSnapshot, Is.EqualTo(new[] { "A" })); registrationList.Flush(); Assert.That(registrationList.IsRegistered("A"), Is.False); Assert.That(registrationList.IsRegistered("B"), Is.True); Assert.That(registrationList.registeredSnapshot, Is.EqualTo(new[] { "B" })); }
public void RegistrationListGetRegisteredItemsIncludesAll() { var registrationList = new XRInteractionManager.RegistrationList <string>(); var registeredItems = new List <string>(); registrationList.GetRegisteredItems(registeredItems); Assert.That(registeredItems, Is.Empty); // Should include pending adds Assert.That(registrationList.Register("A"), Is.True); registrationList.GetRegisteredItems(registeredItems); Assert.That(registeredItems, Is.EqualTo(new[] { "A" })); registrationList.Flush(); // Should still be equal after flush registrationList.GetRegisteredItems(registeredItems); Assert.That(registeredItems, Is.EqualTo(new[] { "A" })); // Should include all in the order they were registered Assert.That(registrationList.Register("B"), Is.True); registrationList.GetRegisteredItems(registeredItems); Assert.That(registeredItems, Is.EqualTo(new[] { "A", "B" })); // Should filter out pending removes from the snapshot Assert.That(registrationList.Unregister("A"), Is.True); registrationList.GetRegisteredItems(registeredItems); Assert.That(registeredItems, Is.EqualTo(new[] { "B" })); }
public void RegistrationListUnregisterReturnsStatusChange() { var registrationList = new XRInteractionManager.RegistrationList <string>(); Assert.That(registrationList.Unregister("A"), Is.False); Assert.That(registrationList.IsRegistered("A"), Is.False); Assert.That(registrationList.Register("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.True); Assert.That(registrationList.Unregister("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.False); registrationList.Flush(); Assert.That(registrationList.IsRegistered("A"), Is.False); Assert.That(registrationList.Unregister("A"), Is.False); Assert.That(registrationList.Register("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.True); registrationList.Flush(); Assert.That(registrationList.IsRegistered("A"), Is.True); Assert.That(registrationList.Unregister("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.False); Assert.That(registrationList.Register("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.True); Assert.That(registrationList.Unregister("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.False); registrationList.Flush(); Assert.That(registrationList.IsRegistered("A"), Is.False); }
public void RegistrationListFastPathMatches() { var registrationList = new XRInteractionManager.RegistrationList <string>(); Assert.That(registrationList.Register("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.True); registrationList.Flush(); Assert.That(registrationList.IsRegistered("A"), Is.True); Assert.That(registrationList.IsStillRegistered("A"), Is.True); Assert.That(registrationList.Unregister("A"), Is.True); Assert.That(registrationList.IsRegistered("A"), Is.False); Assert.That(registrationList.IsStillRegistered("A"), Is.False); }