Esempio n. 1
0
        public void Compare_Missing_MissingNullUnexpectedNotNull()
        {
            var listComparer = new ListComparer();
            var res = listComparer.Compare(
                new List<string> { "a", "b", "c" },
                new List<string> { "a", "b", "c" },
                ListComparer.Comparison.UnexpectedItems
                );

            Assert.That(res.Missing, Is.Null.Or.Empty);
            Assert.That(res.Unexpected, Is.Not.Null);
        }
Esempio n. 2
0
        public void Compare_MissingAndOneMissingItem_MissingHasCountOfOneWithCorrectMissingItem()
        {
            var listComparer = new ListComparer();
            var res = listComparer.Compare(
                new List<string> { "a", "b", "z"},
                new List<string> { "a", "b" },
                ListComparer.Comparison.Both
                );

            Assert.That(res.Missing, Has.Count.EqualTo(1));
            Assert.That(res.Missing.ElementAt(0), Is.EqualTo("z"));
        }
Esempio n. 3
0
        public void Compare_Both_MissingUnexpectedNotNull()
        {
            var listComparer = new ListComparer();
            var res = listComparer.Compare(
                new List<string> { "a", "b", "c" },
                new List<string> { "a", "b", "c" },
                ListComparer.Comparison.Both
                );

            Assert.That(res.Missing, Is.Not.Null);
            Assert.That(res.Unexpected, Is.Not.Null);
        }
Esempio n. 4
0
        public void Compare_BothWithMissingAndUnexpectedItems_MissingUnexpectedNotNullAndNotEmpty()
        {
            var listComparer = new ListComparer();
            var res = listComparer.Compare(
                new List<string> { "a", "b", "c" },
                new List<string> { "a", "b", "d" },
                ListComparer.Comparison.Both
                );

            Assert.That(res.Missing, Is.Not.Null.And.Not.Empty);
            Assert.That(res.Unexpected, Is.Not.Null.And.Not.Empty);
        }
Esempio n. 5
0
        public void Compare_UnexpectedAndOneUnexpectedItem_UnexpectedHasCountOfOneWithCorrectUnexpectedItem()
        {
            var listComparer = new ListComparer();
            var res = listComparer.Compare(
                new List<string> { "a", "b" },
                new List<string> { "a", "b", "z" },
                ListComparer.Comparison.Both
                );

            Assert.That(res.Unexpected, Has.Count.EqualTo(1));
            Assert.That(res.Unexpected.ElementAt(0), Is.EqualTo("z"));
        }
Esempio n. 6
0
        public void Sample_LessThan10Items_DontThrowException()
        {
            var listComparer = new ListComparer();
            var res = listComparer.Compare(
                new List<string> { "a", "b", "c", "d", "e", "f", "g", "h" },
                new List<string> { "z" },
                ListComparer.Comparison.Both
                );

            var sampledRes = res.Sample(2);

            Assert.That(sampledRes.Missing.Count(), Is.EqualTo(2));
            Assert.That(sampledRes.MissingCount, Is.GreaterThan(2));

            Assert.That(sampledRes.Unexpected.Count(), Is.EqualTo(1));
            Assert.That(sampledRes.UnexpectedCount, Is.EqualTo(1));
        }