示例#1
0
        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" }));
        }
示例#2
0
        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" }));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }