Ejemplo n.º 1
0
 public void ConstructFromSuite()
 {
     TestNode test = new TestNode( testSuite );
     Assert.IsNotNull( test.Tests );
     Assert.AreEqual( test.TestCount, CountTests( test ) );
     Assert.AreSame( test, ((TestNode)test.Tests[0]).Parent );
 }
Ejemplo n.º 2
0
 public void Add_AddsAChild()
 {
     TestNode<int> sut = new TestNode<int>();
     TestNode<int> child = new TestNode<int>(1);
     sut.Add(child);
     CollectionAssert.AreEqual(new[] { child }, sut);
 }
Ejemplo n.º 3
0
        public void TestAddCase2()
        {
            var tree = new AvlTree<TestNode> ();
            var t3 = new TestNode (3);
            var t24 = new TestNode (24);
            var t26 = new TestNode (26);

            tree.Add (t3);

            Assert.AreEqual (1, tree.Count);
            tree.Remove (t3);

            tree.Add (new TestNode (37));
            tree.Add (new TestNode (70));
            tree.Add (new TestNode (12));

            Assert.AreEqual (3, tree.Count);

            tree.Add (new TestNode (90));
            tree.Add (new TestNode (25));
            tree.Add (new TestNode (99));
            tree.Add (new TestNode (91));
            tree.Add (t24);
            tree.Add (new TestNode (28));
            tree.Add (t26);

            // Should do a single left rotation on node with key 12
            tree.Remove (t24);
            Assert.IsTrue (tree.Root.Left == t26, "was:" + tree.Root.Left);
        }
        public override void OnTestLoaded(TestNode testNode)
        {
            ClearTree();

            switch (DefaultGroupSetting)
            {
                default:
                case "ASSEMBLY":
                    foreach (TestNode assembly in testNode
                        .Select((node) => node.IsSuite && node.Type == "Assembly"))
                    {
                        TreeNode treeNode = MakeTreeNode(assembly, false);

                        foreach (TestNode fixture in GetTestFixtures(assembly))
                            treeNode.Nodes.Add(MakeTreeNode(fixture, true));

                        _view.Tree.Add(treeNode);
                        CollapseToFixtures(treeNode);
                    }
                    break;

                case "CATEGORY":
                case "OUTCOME":
                case "DURATION":
                    _grouping.Load(GetTestFixtures(testNode));

                    UpdateDisplay();

                    break;
            }
        }
Ejemplo n.º 5
0
 /// <summary> the method is responsible for compiling a TestCE pattern to a testjoin node.
 /// It uses the globally declared prevCE and prevJoinNode
 /// </summary>
 public virtual BaseJoin compileJoin(ICondition condition, int position, Rule.IRule rule)
 {
     TestCondition tc = (TestCondition) condition;
     ShellFunction fn = (ShellFunction) tc.Function;
     fn.lookUpFunction(ruleCompiler.Engine);
     IParameter[] oldpm = fn.Parameters;
     IParameter[] pms = new IParameter[oldpm.Length];
     for (int ipm = 0; ipm < pms.Length; ipm++)
     {
         if (oldpm[ipm] is ValueParam)
         {
             pms[ipm] = ((ValueParam) oldpm[ipm]).cloneParameter();
         }
         else if (oldpm[ipm] is BoundParam)
         {
             BoundParam bpm = (BoundParam) oldpm[ipm];
             // now we need to resolve and setup the BoundParam
             Binding b = rule.getBinding(bpm.VariableName);
             BoundParam newpm = new BoundParam(b.LeftRow, b.LeftIndex, 9, bpm.ObjectBinding);
             newpm.VariableName = bpm.VariableName;
             pms[ipm] = newpm;
         }
     }
     BaseJoin joinNode = null;
     if (tc.Negated)
     {
         joinNode = new NTestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
     }
     else
     {
         joinNode = new TestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
     }
     ((TestNode) joinNode).lookUpFunction(ruleCompiler.Engine);
     return joinNode;
 }
Ejemplo n.º 6
0
        // TODO(HonzaS): test the special subclasses of MyNode (Input/Output nodes etc.)
        public NodeConnectionTests()
        {
            m_node1 = new TestNode();
            m_node2 = new TestNode();

            m_connection = new MyConnection(m_node1, m_node2, 0, 0);
            m_connection.Connect();
        }
Ejemplo n.º 7
0
        public void NodeExtensions_AddsChildren()
        {
            TestNode<int> child1 = new TestNode<int>(1);
            TestNode<int> child2 = new TestNode<int>(2);

            TestNode<int> result = 1.Node(child1, child2);

            CollectionAssert.AreEqual(new[] { child1, child2 }, result);
        }
Ejemplo n.º 8
0
        public void AddRange_AddsChildren()
        {
            TestNode<int> sut = new TestNode<int>();
            TestNode<int> child1 = new TestNode<int>(1);
            TestNode<int> child2 = new TestNode<int>(2);

            sut.AddRange(new[] { child1, child2 });

            CollectionAssert.AreEqual(new[] { child1, child2 }, sut);
        }
        public void WhenTestsAreReloaded_ProgressBar_IsInitialized()
        {
            _model.HasTests.Returns(true);
            _model.IsTestRunning.Returns(false);

            var testNode = new TestNode("<test-suite id='1' testcasecount='1234'/>");
            _model.TestReloaded += Raise.Event<TestNodeEventHandler>(new TestNodeEventArgs(TestAction.TestReloaded, testNode));

            _view.Received().Initialize(100);
        }
Ejemplo n.º 10
0
        public void SimulateTestRunFinish()
        {
            Model.HasTests.Returns(true);
            Model.IsTestRunning.Returns(false);

            XmlDocument doc = new XmlDocument();
            doc.LoadXml("<test-suite/>");
            TestNode resultNode = new TestNode(doc.FirstChild);
            Model.RunFinished += Raise.Event<TestEventHandler>(new TestEventArgs(TestAction.RunFinished, resultNode));
        }
Ejemplo n.º 11
0
 private static XmlNode FindXmlNode(XmlNode currentXml, TestNode testNodeChild)
 {
     foreach (XmlNode child in currentXml.ChildNodes)
     {
         if ((child.LocalName == "test-case" || child.LocalName == "test-suite")
             && testNodeChild.FullName == child.Attributes["fullname"].Value)
             return child;
     }
     return null;
 }
Ejemplo n.º 12
0
        private readonly List<AssemblyName> _referencedAssemblies; // = new List<AssemblyName>();

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="T:AssemblyFetcher"/> class.
        /// </summary>
        /// <param name="methodVisibility">The method visibility to parse.</param>
        /// <param name="assemblyName">Description text of the root assembly node.</param>
        /// <param name="inputAssemblies">The list of input assemblies.</param>
        public AssemblyFetcher(MemberVisibility methodVisibility, string assemblyName, IEnumerable<string> inputAssemblies)
        {
            Guard.NotNullOrEmpty(() => assemblyName, assemblyName);
            Guard.NotNull(() => inputAssemblies, inputAssemblies);

            _assemblyGraphTreeView = new TestNode() { Text = assemblyName };
            _inputAssemblyOpenFileDialog = inputAssemblies.ToList();
            _referencedAssemblies = new List<AssemblyName>();
            this.methodVisibility = methodVisibility;
        }
Ejemplo n.º 13
0
        public void ToolStrip_RunSelectedCommand_RunsSelectedTest()
        {
            var testNode = new TestNode("<test-case id='123'/>");
            var treeNode = new TreeNode("test");
            treeNode.Tag = testNode;

            _view.Tree.SelectedNodeChanged += Raise.Event<TreeNodeActionHandler>(treeNode);
            _view.RunSelectedCommand.Execute += Raise.Event<CommandHandler>();
            _model.Received().RunTests(testNode);
        }
Ejemplo n.º 14
0
        public void ConstructWithParametersTextTestNodeTypeTagValueTest()
        {
            this.text = "Value of text";
            this.testObjectClr = new TestNode(this.text, this.testNodeType, this.tagValueClrType);
            Assert.Throws<ArgumentNullException>(() => new TestNode(null, this.testNodeType, this.tagValueClrType));
            Assert.Throws<ArgumentException>(() => new TestNode(string.Empty, this.testNodeType, this.tagValueClrType));

            //Assert.Throws<ArgumentOutOfRangeException>(() => new TestNode(this.text, this.testNodeType, null));
            //Assert.Throws<ArgumentOutOfRangeException>(() => new TestNode(this.text, this.testNodeType, "other Type"));
        }
        public void AnalysisController_BuildNodeClass_ShouldReturnDefaultClassesWithNodeId()
        {
            // Arrange
            var node = new TestNode("abc", 0) { NodeId = 456 };

            // Act
            var nodeClass = AnalysisController.BuildNodeClass(node);

            // Assert
            Assert.AreEqual("ast-node ast-node-456", nodeClass);
        }
Ejemplo n.º 16
0
 public static string GetTestType(TestNode testNode)
 {
     if (testNode.RunState == RunState.NotRunnable && testNode.Type == "Assembly")
     {
         var fi = new FileInfo(testNode.FullName);
         string extension = fi.Extension.ToLower();
         if (extension != ".exe" && extension != ".dll")
           return "Unknown";
     }
     return testNode.Type;
 }
Ejemplo n.º 17
0
        public void SimulateTestLoad()
        {
            Model.HasTests.Returns(true);
            Model.IsTestRunning.Returns(false);

            XmlDocument doc = new XmlDocument();
            doc.LoadXml("<test-suite id='1'/>");
            TestNode testNode = new TestNode(doc.FirstChild);
            Model.Tests.Returns(testNode);
            Model.TestLoaded += Raise.Event<TestNodeEventHandler>(new TestNodeEventArgs(TestAction.TestLoaded, testNode));
        }
Ejemplo n.º 18
0
        private int CountTests( TestNode node )
        {
            if ( !node.IsSuite )
                return 1;

            int count = 0;
            if ( node.Tests != null )
                foreach( TestNode child in node.Tests )
                    count += CountTests( child );

            return count;
        }
Ejemplo n.º 19
0
		public void TestRemoveBug ()
		{
			var tree = new RedBlackTree<TestNode> ();
			TestNode t1 = new TestNode (1);
			TestNode t2 = new TestNode (2);
			TestNode t3 = new TestNode (3);
			
			tree.Add (t1);
			tree.InsertRight (t1, t2);
			tree.InsertLeft (t1, t3);
			tree.Remove (t1);
			Assert.AreEqual (2, tree.Count);
		} 
        public override void OnTestLoaded(TestNode testNode)
        {
            ClearTree();

            foreach (var topLevelNode in testNode.Children)
            {
                var treeNode = MakeTreeNode(topLevelNode, true);

                _view.Tree.Add(treeNode);

                SetInitialExpansion(treeNode);
            }
        }
        public void AnalysisController_RenderExpressionAsHtml_ShouldRenderContentBeforeAllNodes()
        {
            // Arrange
            var nodes = new TestNode("abcdef", 0, new Node[]
            {
                new TestNode("def", 3) { NodeId = 1 }
            });

            // Act
            var result = AnalysisController.RenderExpressionAsHtml(nodes).ToHtmlString();

            // Assert
            Assert.AreEqual("abc<span class=\"ast-node ast-node-1\" title=\"3\">def</span>", result);
        }
Ejemplo n.º 22
0
        public void ShouldUpdateNode()
        {
            var nodeToUpdate = new TestNode { Foo = "foo", Bar = "bar", Baz = "baz" };

            using (var testHarness = new RestTestHarness
                {
                    {
                        MockRequest.Get("/node/456"),
                        MockResponse.Json(HttpStatusCode.OK, @"{ 'self': 'http://foo/db/data/node/456',
                          'data': { 'Foo': 'foo',
                                    'Bar': 'bar',
                                    'Baz': 'baz'
                          },
                          'create_relationship': 'http://foo/db/data/node/456/relationships',
                          'all_relationships': 'http://foo/db/data/node/456/relationships/all',
                          'all_typed relationships': 'http://foo/db/data/node/456/relationships/all/{-list|&|types}',
                          'incoming_relationships': 'http://foo/db/data/node/456/relationships/in',
                          'incoming_typed relationships': 'http://foo/db/data/node/456/relationships/in/{-list|&|types}',
                          'outgoing_relationships': 'http://foo/db/data/node/456/relationships/out',
                          'outgoing_typed relationships': 'http://foo/db/data/node/456/relationships/out/{-list|&|types}',
                          'properties': 'http://foo/db/data/node/456/properties',
                          'property': 'http://foo/db/data/node/456/property/{key}',
                          'traverse': 'http://foo/db/data/node/456/traverse/{returnType}'
                        }")
                    },
                                        {
                        MockRequest.PutObjectAsJson("/node/456/properties", nodeToUpdate),
                        MockResponse.Http((int)HttpStatusCode.NoContent)
                    }
                })
            {
                var graphClient = testHarness.CreateAndConnectGraphClient();

                //Act
                var pocoReference = new NodeReference<TestNode>(456);
                graphClient.Update(
                    pocoReference, nodeFromDb =>
                    {
                        nodeFromDb.Foo = "fooUpdated";
                        nodeFromDb.Baz = "bazUpdated";
                        nodeToUpdate = nodeFromDb;
                    }
                    );

                Assert.AreEqual("fooUpdated", nodeToUpdate.Foo);
                Assert.AreEqual("bazUpdated", nodeToUpdate.Baz);
                Assert.AreEqual("bar", nodeToUpdate.Bar);
            }
        }
        public void AnalysisController_RenderExpressionAsHtml_ShouldEncodeDataBeforeBetweenAfterAndWithinNodes()
        {
            // Arrange
            var nodes = new TestNode("<<<<<", 0, new Node[]
            {
                new TestNode("<", 1) { NodeId = 1 },
                new TestNode("<", 3) { NodeId = 2 }
            });

            // Act
            var result = AnalysisController.RenderExpressionAsHtml(nodes).ToHtmlString();

            // Assert
            Assert.AreEqual("&lt;<span class=\"ast-node ast-node-1\" title=\"1\">&lt;</span>&lt;<span class=\"ast-node ast-node-2\" title=\"3\">&lt;</span>&lt;", result);
        }
Ejemplo n.º 24
0
        public void JsonSerializerShouldSerializeAllProperties()
        {
            // Arrange
            var testNode = new TestNode { Foo = "foo", Bar = "bar" };
            var serializer = new CustomJsonSerializer
                {
                    NullHandling = NullValueHandling.Ignore,
                    JsonConverters = GraphClient.DefaultJsonConverters
                };

            // Act
            var result = serializer.Serialize(testNode);
            const string expectedValue = "{\r\n  \"Foo\": \"foo\",\r\n  \"Bar\": \"bar\"\r\n}";

            // Assert
            Assert.AreEqual(expectedValue, result);
        }
Ejemplo n.º 25
0
        protected override void Load(TestNode testNode)
        {
            ClearTree();

            switch (_groupBy)
            {
                default:
                case "ASSEMBLY":
                    foreach (TestNode assembly in testNode
                        .Select((node) => node.IsSuite && node.Type == "Assembly"))
                    {
                        TreeNode treeNode = MakeTreeNode(assembly, false);

                        foreach (TestNode test in GetTestCases(assembly))
                            treeNode.Nodes.Add(MakeTreeNode(test, true));

                        _view.Tree.Add(treeNode);
                        treeNode.ExpandAll();
                    }
                    break;

                case "FIXTURE":
                    foreach (TestNode fixture in testNode
                        .Select((node) => node.IsSuite && node.Type == "TestFixture"))
                    {
                        TreeNode treeNode = MakeTreeNode(fixture, false);

                        foreach (TestNode test in GetTestCases(fixture))
                            treeNode.Nodes.Add(MakeTreeNode(test, true));

                        _view.Tree.Add(treeNode);
                        treeNode.ExpandAll();
                    }
                    break;

                case "CATEGORY":
                case "OUTCOME":
                case "DURATION":
                    _grouping.Load(GetTestCases(testNode));

                    UpdateDisplay();

                    break;
            }
        }
Ejemplo n.º 26
0
        public override void OnTestLoaded(TestNode testNode)
        {
            ClearTree();

            TreeNode topNode = null;
            foreach (var topLevelNode in testNode.Children)
            {
                var treeNode = MakeTreeNode(topLevelNode, true);

                if (topNode == null)
                    topNode = treeNode;

                _view.Tree.Add(treeNode);

                SetInitialExpansion(treeNode);
            }

            topNode?.EnsureVisible();
        }
Ejemplo n.º 27
0
        public void ShouldReplaceNode()
        {
            var newData = new TestNode { Foo = "foo", Bar = "bar", Baz = "baz" };

            using (var testHarness = new RestTestHarness
            {
                {
                    MockRequest.PutObjectAsJson("/node/456/properties", newData),
                    MockResponse.Http((int)HttpStatusCode.NoContent)
                }
            })
            {
                var graphClient = testHarness.CreateAndConnectGraphClient();

                //Act
                var pocoReference = new NodeReference<TestNode>(456);
                graphClient.Update(pocoReference, newData);
            }
        }
Ejemplo n.º 28
0
        public void ConstructFromMultipleTests()
        {
            ITest[] tests = new ITest[testFixture.Tests.Count];
            for( int index = 0; index < tests.Length; index++ )
                tests[index] = (ITest)testFixture.Tests[index];

            TestName testName = new TestName();
            testName.FullName = testName.Name = "Combined";
            testName.TestID = new TestID( 1000 );
            TestNode test = new TestNode( testName, tests );
            Assert.AreEqual( "Combined", test.TestName.Name );
            Assert.AreEqual( "Combined", test.TestName.FullName );
            Assert.AreEqual( RunState.Runnable, test.RunState );
            Assert.IsTrue( test.IsSuite, "IsSuite" );
            Assert.AreEqual( tests.Length, test.Tests.Count );
            Assert.AreEqual( MockTestFixture.Tests, test.TestCount );
            Assert.AreEqual( 0, test.Categories.Count, "Categories");
            Assert.AreNotEqual( testFixture.TestName.Name, test.TestName.Name, "TestName" );
        }
Ejemplo n.º 29
0
        private TestGroup SelectGroup(TestNode testNode)
        {
            var group = Groups[3]; // NotRun

            var result = testNode as ResultNode;
            if (result == null)
                result = _displayStrategy.GetResultForTest(testNode);

            if (result != null)
            {
                group = result.Duration > 1.0
                    ? Groups[0]
                    : result.Duration > 0.1
                        ? Groups[1]
                        : Groups[2];
            }

            return group;
        }
Ejemplo n.º 30
0
        public EdmxTestCase AddEntityType(string entityTypeKey, bool noKey, Action<EdmxTestCase, XElement> config = null)
        {
            var schema = _testObjectMap[Keys.Schema];

            schema.Element.Add(Any.Csdl.EntityType(entityType =>
            {
                var testNode = new TestNode(schema.Namespace, entityType.Attribute("Name").Value, entityType);
                _testObjectMap.Add(entityTypeKey, testNode);

                if (!noKey)
                {
                    entityType.Add(Any.Csdl.Key(key =>
                    {
                        foreach (
                            var property in
                                Any.Sequence(
                                    i => Any.Csdl.Property(Any.Csdl.RandomPrimitiveType(), false),
                                    Any.Int(1, 2)))
                        {
                            entityType.Add(property);
                            key.Add(Any.Csdl.PropertyRef(property.Attribute("Name").Value));
                        }
                    }));
                }

                foreach (
                    var property in
                        Any.Sequence(
                            i => Any.Csdl.Property(Any.Csdl.RandomPrimitiveType()),
                            Any.Int(1, 3)))
                {
                    entityType.Add(property);
                }

                if (config != null)
                {
                    config(this, entityType);
                }
            }));

            return this;
        }
Ejemplo n.º 31
0
        public async Task AttributesReturnsMultipleAttributesOnMultipleListsDeclaredOnPropertyAccessor()
        {
            var declaringType = Substitute.For <IClassDefinition>();

            var node = await TestNode
                       .FindNode <PropertyDeclarationSyntax>(PropertyDefinitionCode
                                                             .PropertyAccessorWithMultipleAttributesInMultipleLists)
                       .ConfigureAwait(false);

            var sut = new PropertyDefinition(declaringType, node);

            var attributes = sut.GetAccessor !.Attributes;

            attributes.Should().HaveCount(4);

            attributes.First().Name.Should().Be("First");
            attributes.Skip(1).First().Name.Should().Be("Second");
            attributes.Skip(2).First().Name.Should().Be("Third");
            attributes.Skip(3).First().Name.Should().Be("Fourth");
        }
Ejemplo n.º 32
0
        public void ShouldNotUpdateEntityIfNoChangesHaveBeenMade_Detached()
        {
            var node1 = new TestNode
            {
                Title = "Hello"
            };

            using (var context = new TestDbContext())
            {
                node1 = context.Nodes.Add(node1);
                context.SaveChanges();
            } // Simulate detach

            using (var context = new TestDbContext())
            {
                context.UpdateGraph(node1);
                Assert.IsTrue(context.ChangeTracker.Entries().All(p => p.State == EntityState.Unchanged));
                context.SaveChanges();
            }
        }
Ejemplo n.º 33
0
        public void JsonSerializerShouldNotSerializeNullProperties()
        {
            // Arrange
            var testNode = new TestNode {
                Foo = "foo", Bar = null
            };
            var serializer = new CustomJsonSerializer
            {
                NullHandling   = NullValueHandling.Ignore,
                JsonConverters = GraphClient.DefaultJsonConverters
            };

            // Act
            var result = serializer.Serialize(testNode);

            const string expectedValue = "{\r\n  \"Foo\": \"foo\"\r\n}";

            // Assert
            Assert.AreEqual(expectedValue, result);
        }
            public void ParsesDateTimesFromNeo4jCorrectly()
            {
                LocalDateTime ldt  = new LocalDateTime(2000, 3, 1, 1, 1, 1);
                var           node = new TestNode(new Dictionary <string, object> {
                    { "Offset", ldt }
                });
                var record = Substitute.For <IRecord>();

                record.Keys.Returns(new List <string> {
                    "X"
                });
                record["X"].Returns(node);

                var result = record.Parse <ClassWithDateTimeAndAttribute>(GraphClient);

                result.Should().NotBeNull();
                result.Offset.Year.Should().Be(2000);
                result.Offset.Month.Should().Be(3);
                result.Offset.Day.Should().Be(1);
            }
        public void TreeShowsProperResult(ResultState resultState, int expectedIndex)
        {
            _model.IsPackageLoaded.Returns(true);
            _model.HasTests.Returns(true);

            var result = resultState.Status.ToString();
            var label  = resultState.Label;

            var testNode   = new TestNode("<test-run id='1'><test-suite id='123'/></test-run>");
            var resultNode = new ResultNode(string.IsNullOrEmpty(label)
                ? string.Format("<test-suite id='123' result='{0}'/>", result)
                : string.Format("<test-suite id='123' result='{0}' label='{1}'/>", result, label));

            _model.Tests.Returns(testNode);

            _model.Events.TestLoaded    += Raise.Event <TestNodeEventHandler>(new TestNodeEventArgs(testNode));
            _model.Events.SuiteFinished += Raise.Event <TestResultEventHandler>(new TestResultEventArgs(resultNode));

            _view.Tree.Received().SetImageIndex(Arg.Compat.Any <TreeNode>(), expectedIndex);
        }
Ejemplo n.º 36
0
        public override void OnCreate()
        {
            _testNode = (TestNode)target;
            //_testNode.nodeList = new List<NodePort>();

            /*_testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, "test1"));
             * _testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, "test2"));
             * _testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, "test3"));*
             * _testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, "tutu"));
             * _testNode.index++;
             * _testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, "tutu" + (char)_testNode.index));
             * _testNode.index++;
             * _testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, "tutu" + (char)_testNode.index));
             * _testNode.index++;*/
            //_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, nameTmp[_testNode.index]);
            //_testNode.index++;
            //_testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited, "TUTU"));
            //_testNode.nodeList.Add(_testNode.AddDynamicInput(typeof(Tile), Node.ConnectionType.Override, Node.TypeConstraint.Inherited));
            Debug.Log(_testNode.nodeList.Count);
        }
            public void ParsesDateTimeOffsetCorrectly()
            {
                const string dtoffsetString = "2000-03-01T00:00:00+00:00";
                var          node           = new TestNode(new Dictionary <string, object> {
                    { "Offset", dtoffsetString }
                });
                var record = Substitute.For <IRecord>();

                record.Keys.Returns(new List <string> {
                    "X"
                });
                record["X"].Returns(node);

                var result = record.Parse <ClassWithDateTime>(GraphClient);

                result.Should().NotBeNull();
                result.Offset.Year.Should().Be(2000);
                result.Offset.Month.Should().Be(3);
                result.Offset.Day.Should().Be(1);
            }
Ejemplo n.º 38
0
 // Use this for initialization
 void Start()
 {
     turretUI.SetActive(false);
     onNode = CameraController.Instance.currentClickNode;
     if (photonView.isMine)
     {
         if (PlayerNetwork.Instance.joinRoomNum == 1)
         {
             TestNode setTurret = TestNode1.Instance.node [onNode];
             setTurret.SetTurret(gameObject, this);
         }
         if (PlayerNetwork.Instance.joinRoomNum == 2)
         {
             TestNode setTurret = TestNode2.Instance.node [onNode];
             setTurret.SetTurret(gameObject, this);
         }
     }
     PhotonView = GetComponent <PhotonView> ();
     InvokeRepeating("UpdateTarget", 0f, 0.5f);
 }
Ejemplo n.º 39
0
        public void ShouldReplaceNodeWithIndexEntries()
        {
            var newData = new TestNode {
                Foo = "foo", Bar = "bar", Baz = "baz"
            };

            using (var testHarness = new RestTestHarness
            {
                {
                    MockRequest.PutObjectAsJson("/node/456/properties", newData),
                    MockResponse.Http((int)HttpStatusCode.NoContent)
                },
                {
                    MockRequest.Delete("/index/node/foo/456"),
                    MockResponse.Http((int)HttpStatusCode.NoContent)
                },
                {
                    MockRequest.PostObjectAsJson("/index/node/foo", new { key = "foo", value = "bar", uri = "http://foo/db/data/node/456" }),
                    MockResponse.Json(HttpStatusCode.Created, "Location: http://foo/db/data/index/node/foo/bar/456")
                }
            })
            {
                var graphClient = testHarness.CreateAndConnectGraphClient();

                // Act
                var pocoReference = new NodeReference <TestNode>(456);
                graphClient.Update(
                    pocoReference,
                    newData,
                    new []
                {
                    new IndexEntry
                    {
                        Name      = "foo",
                        KeyValues = new Dictionary <string, object> {
                            { "foo", "bar" }
                        },
                    }
                });
            }
        }
        private void DisplaySelectedItem()
        {
            TestNode   testNode   = _selectedItem as TestNode;
            ResultNode resultNode = null;

            // TODO: Insert checks for errors in the XML
            if (_selectedItem != null)
            {
                _view.Header = _selectedItem.Name;

                if (testNode != null)
                {
                    _view.TestPanel.Visible = true;
                    _view.SuspendLayout();

                    DisplayTestInfo(testNode);

                    resultNode = _model.GetResultForTest(testNode.Id);
                    if (resultNode != null)
                    {
                        DisplayResultInfo(resultNode);
                    }

                    _view.ResumeLayout();
                }
            }

            _view.TestPanel.Visible = testNode != null;
            // HACK: results won't display on Linux otherwise
            if (Path.DirectorySeparatorChar == '/') // Running on Linux or Unix
            {
                _view.ResultPanel.Visible = true;
            }
            else
            {
                _view.ResultPanel.Visible = resultNode != null;
            }

            // TODO: We should actually try to set the font for bold items
            // dynamically, since the global application font may be changed.
        }
Ejemplo n.º 41
0
    public void DecreaseKey_MultipleElements()
    {
        var queue = new PriorityQueue <TestNode <int> >();

        var testNode1 = new TestNode <int>()
        {
            Value = 6
        };
        var testNode2 = new TestNode <int>()
        {
            Value = 3
        };
        var testNode3 = new TestNode <int>()
        {
            Value = 4
        };
        var testNode4 = new TestNode <int>()
        {
            Value = 2
        };
        var testNode5 = new TestNode <int>()
        {
            Value = 8
        };

        queue.Enqueue(testNode1);
        queue.Enqueue(testNode2);
        queue.Enqueue(testNode3);
        queue.Enqueue(testNode4);
        queue.Enqueue(testNode5);

        testNode5.Value = 1;
        queue.DecreaseKey(testNode5);

        Assert.AreEqual(1, queue.Dequeue().Value);
        Assert.AreEqual(2, queue.Dequeue().Value);

        testNode1.Value = 1;
        queue.DecreaseKey(testNode1);
        Assert.AreEqual(1, queue.Dequeue().Value);
    }
Ejemplo n.º 42
0
        public IPathResolver Resolve(TestContext ctx, TestNode node)
        {
            Resolve(ctx);

            if (innerNode != null)
            {
                innerNode.Resolve(ctx);

                if (!TestNodeInternal.Matches(innerNode.Tree.Host, node))
                {
                    throw new InternalErrorException();
                }
                if (node.ParameterValue != null)
                {
                    return(innerNode.Parameterize(node.ParameterValue));
                }
                return(innerNode);
            }

            if (node.ParameterValue == null)
            {
                throw new InternalErrorException();
            }

            foreach (var child in children)
            {
                if (!TestNodeInternal.Matches(child.Node, node))
                {
                    throw new InternalErrorException();
                }

                if (!node.ParameterValue.Equals(child.Node.Parameter.Value))
                {
                    continue;
                }

                return(child);
            }

            throw new InternalErrorException();
        }
Ejemplo n.º 43
0
            public void DeserilizesProjectedListCorrectly()
            {
                var expectedContent = "{ \"columns\":[\"a\",\"b\"], \"data\":[[ {\"data\":{ \"Value\":\"foo\" }},[{\"nested_b1\":{\"data\":{ \"Value\":\"bar\" }}},{\"nested_b2\":{\"data\":{ \"Value\":\"foobar\" }}}] ]] }";

                var nodeA = new TestNode(new Dictionary <string, object> {
                    { "Value", "foo" }
                });
                var nodeB1 = new TestRelationship(new Dictionary <string, object> {
                    { "Value", "bar" }
                });
                var nodeB2 = new TestNode(new Dictionary <string, object> {
                    { "Value", "foobar" }
                });

                var listB = new List <object>
                {
                    new Dictionary <string, object> {
                        { "nested_b1", nodeB1 }
                    },
                    new Dictionary <string, object> {
                        { "nested_b2", nodeB2 }
                    }
                };

                var record = Substitute.For <IRecord>();

                record.Keys.Returns(new List <string> {
                    "a", "b"
                });
                record["a"].Returns(nodeA);
                record["b"].Returns(listB);

                var mockDeserializer = new Mock <ICypherJsonDeserializer <DerivedClass> >();

                mockDeserializer
                .Setup(d => d.Deserialize(It.IsAny <string>()))
                .Returns(new List <DerivedClass>());

                record.Deserialize(mockDeserializer.Object, CypherResultMode.Projection);
                mockDeserializer.Verify(d => d.Deserialize(expectedContent), Times.Once);
            }
Ejemplo n.º 44
0
        public async Task FindMatchesReturnsMatchesByArguments(string oldCode, string newCode,
                                                               bool expected, string scenario)
        {
            _output.WriteLine(scenario);

            var oldNode = await TestNode
                          .FindNode <AttributeSyntax>(AttributeDefinitionCode.SimpleAttribute.Replace("SimpleAttribute", oldCode))
                          .ConfigureAwait(false);

            var oldAttribute  = new AttributeDefinition(oldNode);
            var oldAttributes = new[]
            {
                oldAttribute
            };
            var newNode = await TestNode
                          .FindNode <AttributeSyntax>(AttributeDefinitionCode.SimpleAttribute.Replace("SimpleAttribute", newCode))
                          .ConfigureAwait(false);

            var newAttribute  = new AttributeDefinition(newNode);
            var newAttributes = new[]
            {
                newAttribute
            };

            var sut = new AttributeEvaluator();

            var results = sut.FindMatches(oldAttributes, newAttributes);

            if (expected)
            {
                results.MatchingItems.Should().HaveCount(1);
                results.MatchingItems.First().OldItem.Should().Be(oldAttribute);
                results.MatchingItems.First().NewItem.Should().Be(newAttribute);
                results.ItemsAdded.Should().BeEmpty();
                results.ItemsRemoved.Should().BeEmpty();
            }
            else
            {
                results.MatchingItems.Should().BeEmpty();
            }
        }
Ejemplo n.º 45
0
        public void TestCanUpdateSlotPriorityByReaddingSlotToTestNode()
        {
            var graph = new TestMaterialGraph();
            var node  = new TestNode();

            node.AddSlot(new TestSlot(0, "output", SlotType.Output, 0));
            node.AddSlot(new TestSlot(0, "output", SlotType.Output, 5));
            node.name = "Test Node";
            graph.AddNode(node);

            Assert.AreEqual(1, graph.GetNodes <INode>().Count());
            var found = graph.GetNodes <INode>().FirstOrDefault();

            Assert.AreEqual(0, found.GetInputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetOutputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetSlots <ISlot>().Count());

            var slot = found.GetOutputSlots <ISlot>().FirstOrDefault();

            Assert.AreEqual(5, slot.priority);
        }
Ejemplo n.º 46
0
        public void ShouldReplaceNode()
        {
            var newData = new TestNode {
                Foo = "foo", Bar = "bar", Baz = "baz"
            };

            using (var testHarness = new RestTestHarness
            {
                {
                    MockRequest.PutObjectAsJson("/node/456/properties", newData),
                    MockResponse.Http((int)HttpStatusCode.NoContent)
                }
            })
            {
                var graphClient = testHarness.CreateAndConnectGraphClient();

                //Act
                var pocoReference = new NodeReference <TestNode>(456);
                graphClient.Update(pocoReference, newData);
            }
        }
Ejemplo n.º 47
0
        public void DegreeIsCorrectAfterRemovingEdge()
        {
            Graph    g  = new Graph();
            TestNode n1 = new TestNode("n1", g);
            TestNode n2 = new TestNode("n2", g);
            TestNode n3 = new TestNode("n3", g);

            n1.AddNeighbor(n2);
            n1.AddNeighbor(n3);
            n2.AddNeighbor(n3);

            Assert.AreEqual(2, n1.Degree);
            Assert.AreEqual(2, n2.Degree);
            Assert.AreEqual(2, n3.Degree);

            n2.RemoveNeighbor(n3);

            Assert.AreEqual(2, n1.Degree);
            Assert.AreEqual(1, n2.Degree);
            Assert.AreEqual(1, n3.Degree);
        }
Ejemplo n.º 48
0
        private void HideTestsUnderNode(TestNode test)
        {
            if (test.IsSuite && _treeMap.ContainsKey(test.Id))
            {
                TreeNode node = _treeMap[test.Id];

                if (test.Type == "TestFixture")
                {
                    node.Collapse();
                }
                else
                {
                    node.Expand();

                    foreach (TestNode child in test.Children)
                    {
                        HideTestsUnderNode(child);
                    }
                }
            }
        }
Ejemplo n.º 49
0
        public void TestCanUpdateDisplaynameByReaddingSlotToTestNode()
        {
            var graph = new TestMaterialGraph();
            var node  = new TestNode();

            node.AddSlot(new TestSlot(0, "output", SlotType.Output));
            node.AddSlot(new TestSlot(0, "output_updated", SlotType.Output));
            node.name = "Test Node";
            graph.AddNode(node);

            Assert.AreEqual(1, graph.GetNodes <INode>().Count());
            var found = graph.GetNodes <INode>().FirstOrDefault();

            Assert.AreEqual(0, found.GetInputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetOutputSlots <ISlot>().Count());
            Assert.AreEqual(1, found.GetSlots <ISlot>().Count());

            var slot = found.GetOutputSlots <ISlot>().FirstOrDefault();

            Assert.AreEqual("output_updated(4)", slot.displayName);
        }
        public async Task MergePartialTypeMergesModifiers(string firstModifiers, string secondModifiers,
                                                          InterfaceModifiers expected)
        {
            var firstCode =
                TypeDefinitionCode.EmptyInterface.Replace("interface", firstModifiers + " partial interface");
            var secondCode = TypeDefinitionCode.EmptyInterface
                             .Replace("interface", secondModifiers + " partial interface");

            var firstNode = await TestNode.FindNode <InterfaceDeclarationSyntax>(firstCode)
                            .ConfigureAwait(false);

            var secondNode = await TestNode.FindNode <InterfaceDeclarationSyntax>(secondCode)
                             .ConfigureAwait(false);

            var firstDefinition  = new InterfaceDefinition(firstNode);
            var secondDefinition = new InterfaceDefinition(secondNode);

            firstDefinition.MergePartialType(secondDefinition);

            firstDefinition.Modifiers.Should().Be(expected);
        }
Ejemplo n.º 51
0
        public void Test_Can_Refresh()
        {
            // Arrange.
            var underTest = new TestNode("1");

            // Act.
            var couldInitiallyExecute = underTest.RefreshCommand.CanExecute(null);

            underTest.ExpandedCommand.Execute(null);

            var couldExecuteAfterExpansion = underTest.RefreshCommand.CanExecute(null);

            underTest.RefreshCommand.Execute(null);

            var couldExecuteAfterRefresh = underTest.RefreshCommand.CanExecute(null);

            // Assert.
            Assert.False(couldInitiallyExecute);
            Assert.True(couldExecuteAfterExpansion);
            Assert.False(couldExecuteAfterRefresh);
        }
        public async Task GenericConstraintsReturnsMultipleDeclaredConstraints()
        {
            var node = await TestNode
                       .FindNode <StructDeclarationSyntax>(TypeDefinitionCode.StructWithMultipleGenericConstraints)
                       .ConfigureAwait(false);

            var actual = new StructDefinition(node);

            actual.GenericConstraints.Should().HaveCount(2);

            var firstConstraintList = actual.GenericConstraints.First();

            firstConstraintList.Name.Should().Be("TKey");
            firstConstraintList.Constraints.First().Should().Be("Stream");
            firstConstraintList.Constraints.Skip(1).First().Should().Be("new()");

            var secondConstraintList = actual.GenericConstraints.Skip(1).First();

            secondConstraintList.Name.Should().Be("TValue");
            secondConstraintList.Constraints.First().Should().Be("struct");
        }
Ejemplo n.º 53
0
        public void SetUp()
        {
            MethodInfo fakeTestMethod = GetType().GetMethod("FakeTestCase", BindingFlags.Instance | BindingFlags.NonPublic);
            var        nunitTest      = new NUnitTestMethod(fakeTestMethod);

            nunitTest.Categories.Add("cat1");
            nunitTest.Properties.Add("Priority", "medium");

            var nunitFixture = new TestSuite("FakeNUnitFixture");

            nunitFixture.Categories.Add("super");
            nunitFixture.Add(nunitTest);

            Assert.That(nunitTest.Parent, Is.SameAs(nunitFixture));

            var fixtureNode = new TestNode(nunitFixture);

            fakeNUnitTest = (ITest)fixtureNode.Tests[0];

            testConverter = new TestConverter(new TestLogger(), ThisAssemblyPath);
        }
        public async Task FieldsReturnsDeclaredFields()
        {
            var node = await TestNode.FindNode <StructDeclarationSyntax>(StructWithFields)
                       .ConfigureAwait(false);

            var sut = new StructDefinition(node);

            sut.Fields.Should().HaveCount(2);

            var first = sut.Fields.First();

            first.Name.Should().Be("First");
            first.IsVisible.Should().BeTrue();
            first.ReturnType.Should().Be("string");

            var second = sut.Fields.Skip(1).First();

            second.Name.Should().Be("Second");
            second.IsVisible.Should().BeTrue();
            second.ReturnType.Should().Be("DateTimeOffset");
        }
Ejemplo n.º 55
0
        public void AncestorsAndDepthTest()
        {
            var root = new TestNode {
                Value = "Root Node"
            };

            Assert.IsNotNull(root.Ancestors, "Ancestors is null");
            Assert.IsFalse(root.Ancestors.Any(), "Root ancestors is not empty");
            Assert.AreEqual(1, root.Depth, "Expected root to have depth 1");
            var node1 = new TestNode()
            {
                Value = "Node 1"
            };

            root.AddChild(node1);
            Assert.AreEqual(1, node1.Ancestors.Count(), "Expected 1 ancestors");
            Assert.AreSame(root, node1.Ancestors.First(), "Expected root to be first ancestor of node 1");
            Assert.AreEqual(2, node1.Depth, "Expected node1 to have depth 2");
            var node1S1 = new TestNode()
            {
                Value = "Node 1.1"
            };

            node1.AddChild(node1S1);
            Assert.AreEqual(2, node1S1.Ancestors.Count(), "Expected 2 ancestors");
            Assert.AreSame(node1, node1S1.Ancestors.First(), "Expected node 1 to be first ancestor of node 1.1");
            Assert.AreSame(root, node1S1.Ancestors.Last(), "Expected root to be last ancestor of node 1.1");
            Assert.AreEqual(3, node1S1.Depth, "Expected node1S1 to have depth 3");
            var node1S1S1 = new TestNode()
            {
                Value = "Node 1.1.1"
            };

            node1S1.AddChild(node1S1S1);
            Assert.AreEqual(3, node1S1S1.Ancestors.Count(), "Expected 3 ancestors");
            Assert.AreSame(node1S1, node1S1S1.Ancestors.First(), "Expected node 1.1 to be first ancestor of node 1.1.1");
            Assert.AreSame(node1, node1S1S1.Ancestors.ElementAt(1), "Expected node to be ancestor at index 1 of node 1.1");
            Assert.AreSame(root, node1S1S1.Ancestors.Last(), "Expected root to be last ancestor of node 1.1");
            Assert.AreEqual(4, node1S1S1.Depth, "Expected node1S1S1 to have depth 4");
        }
        public void ShouldRemoveItemsInOwnedCollection()
        {
            var node1 = new TestNode
            {
                Title          = "New Node",
                OneToManyOwned = new List <OneToManyOwnedModel>
                {
                    new OneToManyOwnedModel {
                        Title = "Hello"
                    },
                    new OneToManyOwnedModel {
                        Title = "Hello2"
                    },
                    new OneToManyOwnedModel {
                        Title = "Hello3"
                    }
                }
            };

            using (var context = new TestDbContext())
            {
                context.Nodes.Add(node1);
                context.SaveChanges();
            } // Simulate detach

            node1.OneToManyOwned.Remove(node1.OneToManyOwned.First());
            node1.OneToManyOwned.Remove(node1.OneToManyOwned.First());
            node1.OneToManyOwned.Remove(node1.OneToManyOwned.First());
            using (var context = new TestDbContext())
            {
                // Setup mapping
                context.UpdateGraph(node1, map => map
                                    .OwnedCollection(p => p.OneToManyOwned));

                context.SaveChanges();
                var node2 = context.Nodes.Include(p => p.OneToManyOwned).Single(p => p.Id == node1.Id);
                Assert.IsNotNull(node2);
                Assert.IsTrue(node2.OneToManyOwned.Count == 0);
            }
        }
Ejemplo n.º 57
0
        public async Task Given_graph_with_nodes_exposing_flow_facade_When_execute_Then_will_follow_facade_stop_command()
        {
            var root = new LogicNode()
            {
                Name = "root"
            };
            var childA = new TestNode()
            {
                Name     = "nodeA", Parent = root,
                Behavior = f => f.Stop()
            };
            var childB = new LogicNode()
            {
                Name = "nodeB", Parent = root
            };

            root.Children.Add(childA);
            root.Children.Add(childB);

            var nodeAA = new LogicNode()
            {
                Name = "nodeAA", Parent = childA
            };

            childA.Children.Add(nodeAA);

            var graph = new LogicGraph()
            {
                Root = root, ExecutionFlow = new OrderedExecutionFlow(new TestFacadeNodeExecutor())
            };

            var trace = new List <NodeVisitResult>();

            await foreach (var visit in graph.Run())
            {
                trace.Add(visit);
            }

            trace.Select(v => v.Node.Name).Should().Equal("root", "nodeA");
        }
Ejemplo n.º 58
0
    public override void GenerateGraphConections()
    {
        //Debug.Log("Num nodos: " + testNodes.Count);



        nodePositions = new Dictionary <Vector3, TestNode>();
        foreach (TestNode node in testNodes)
        {
            if (!nodePositions.ContainsKey(node.Position))
            {
                nodePositions.Add(node.Position, node);
            }
            nodes.Add(node);
        }



        connections = new List <PathfindingConnection>();
        foreach (ConnectionView conn in connectionViews)
        {
            TestConnection testConnection = new TestConnection(conn.lineRenderer, false, Color.white, Color.green);

            TestNode node1 = nodePositions[conn.startPosition];
            TestNode node2 = nodePositions[conn.endPosition];

            if (!node1.ConnectionDictionary.ContainsKey(node2))
            {
                node1.ConnectionDictionary.Add(node2, testConnection);
            }
            if (!node2.ConnectionDictionary.ContainsKey(node1))
            {
                node2.ConnectionDictionary.Add(node1, testConnection);
            }

            testConnection.ConnectNodes(node1, node2);
            connections.Add(testConnection);
            testConnection.view = conn;
        }
    }
Ejemplo n.º 59
0
        private void InitializeContextMenu()
        {
            _view.ShowCheckBoxes.Checked = _view.CheckBoxes;

            TestSuiteTreeNode targetNode = _view.ContextNode ?? (TestSuiteTreeNode)_view.Tree.SelectedNode;

            if (targetNode != null)
            {
                TestNode test = targetNode.Test;

                _view.RunCommand.DefaultItem = _view.RunCommand.Enabled && targetNode.Included &&
                                               (test.RunState == RunState.Runnable || test.RunState == RunState.Explicit);

                TestSuiteTreeNode theoryNode = targetNode.GetTheoryNode();
                _view.ShowFailedAssumptions.Visible = _view.ShowFailedAssumptions.Enabled = theoryNode != null;
                _view.ShowFailedAssumptions.Checked = theoryNode?.ShowFailedAssumptions ?? false;

                _view.ActiveConfiguration.Visible = _view.ActiveConfiguration.Enabled = false;
                if (test.IsProject)
                {
                    TestPackage package      = _model.GetPackageForTest(test.Id);
                    string      activeConfig = _model.GetActiveConfig(package);
                    var         configNames  = _model.GetConfigNames(package);

                    if (configNames.Count > 0)
                    {
                        _view.ActiveConfiguration.MenuItems.Clear();
                        foreach (string config in configNames)
                        {
                            var configEntry = new MenuItem(config);
                            configEntry.Checked = config == activeConfig;
                            configEntry.Click  += (sender, e) => _model.ReloadPackage(package, ((MenuItem)sender).Text);
                            _view.ActiveConfiguration.MenuItems.Add(configEntry);
                        }

                        _view.ActiveConfiguration.Visible = _view.ActiveConfiguration.Enabled = true;
                    }
                }
            }
        }
        public void Filter()
        {
            TestNode[] nodes = new TestNode[] {
                new TestNode {
                    Key = "key"
                },
                new TestNode {
                    Key = "key2"
                }
            };

            var view = new SimpleCollectionView(nodes, new SimpleCollectionViewOptions {
                DisplaySelector = TestNodeDisplaySelector
            });

            Assume.That(view, Contains.Item(nodes[0]));
            Assume.That(view, Contains.Item(nodes[1]));

            bool changed = false;

            view.CollectionChanged += (sender, e) => {
                changed = true;
                Assert.That(e.Action, Is.EqualTo(NotifyCollectionChangedAction.Remove).Or.EqualTo(NotifyCollectionChangedAction.Reset));
                if (e.Action == NotifyCollectionChangedAction.Remove)
                {
                    Assert.That(e.OldItems, Contains.Item(nodes[0]));
                    Assert.That(e.OldStartingIndex, Is.EqualTo(0));
                }
            };

            view.Options.Filter = o => ((TestNode)o).Key.StartsWith("key");
            Assert.That(changed, Is.False);
            Assert.That(view, Contains.Item(nodes[0]));
            Assert.That(view, Contains.Item(nodes[1]));

            view.Options.Filter = o => ((TestNode)o).Key.StartsWith("key2");
            Assert.That(changed, Is.True);
            Assert.That(view, Does.Not.Contain(nodes[0]));
            Assert.That(view, Contains.Item(nodes[1]));
        }