Example #1
0
        public void Set_TypeSplit()
        {
            IReadOnlyList <SubTestAnalysisValue> ofType;
            IAnalysisSet rest;

            var testAv = new TestAnalysisValue {
                _name = "A", Value = "A"
            };
            var subTestAv = new SubTestAnalysisValue {
                _name = "B", Value = "B"
            };

            Assert.IsTrue(subTestAv.Split(out ofType, out rest));
            Assert.AreEqual(1, ofType.Count);
            Assert.AreSame(subTestAv, ofType[0]);
            Assert.AreEqual(0, rest.Count);

            Assert.IsFalse(testAv.Split(out ofType, out rest));
            Assert.AreEqual(0, ofType.Count);
            Assert.AreSame(testAv, rest);

            var set = AnalysisSet.Create(new[] { testAv, subTestAv });

            Assert.IsTrue(set.Split(out ofType, out rest));
            Assert.AreEqual(1, ofType.Count);
            Assert.AreSame(testAv, rest);

            set = AnalysisSet.Create(new[] { nsA1, nsB1, nsC1 });
            Assert.IsFalse(set.Split(out ofType, out rest));
            Assert.AreEqual(0, ofType.Count);
            Assert.AreSame(set, rest);
        }
        public void Set_TypeSplit()
        {
            var testAv = new TestAnalysisValue {
                _name = "A", Value = "A"
            };
            var subTestAv = new SubTestAnalysisValue {
                _name = "B", Value = "B"
            };

            subTestAv.Split(out IReadOnlyList <SubTestAnalysisValue> ofType, out var rest).Should().BeTrue();
            ofType.Should().ContainSingle().Which.Should().BeSameAs(subTestAv);
            rest.Should().BeEmpty();

            testAv.Split(out ofType, out rest).Should().BeFalse();
            ofType.Should().BeEmpty();
            rest.Should().BeSameAs(testAv);

            var set = AnalysisSet.Create(new[] { testAv, subTestAv });

            set.Split(out ofType, out rest).Should().BeTrue();
            ofType.Should().ContainSingle();
            rest.Should().BeSameAs(testAv);

            set = AnalysisSet.Create(new[] { nsA1, nsB1, nsC1 });
            set.Split(out ofType, out rest).Should().BeFalse();
            ofType.Should().BeEmpty();
            rest.Should().BeSameAs(set);
        }