public void Same_Sets_Produce_Empty_Set_On_Difference()
		{
			var a = new [] { 1 };
			var b = new [] { 1 };

			var c = a.Difference(b);

			Expect(c, Is.Not.Null);
			Expect(c.Count, Is.EqualTo(0));
		}
		public void Two_Sided_Difference()
		{
			var a = new[] { 1, 2 };
			var b = new[] { 1, 3 };

			var c = a.Difference(b);

			Expect(c, Is.Not.Null);
			Expect(c.Count, Is.EqualTo(2));
			Expect(c.SetEquals(new [] { 2, 3 }));
		}
		public void One_Sided_Difference()
		{
			var a = new[] { 1, 2 };
			var b = new[] { 1 };

			var c = a.Difference(b);

			Expect(c, Is.Not.Null);
			Expect(c.Count, Is.EqualTo(1));
			Expect(c.First(), Is.EqualTo(2));
		}
Пример #4
0
        public void DifferenceTest()
        {
            var a = new[] { 1, 2, 3, 4, 5, 6, 7 };
            var b = new[] { 4, 5, 6, 7, 8, 9, 10 };

            IEnumerable<int> expected = new[] { 1, 2, 3, 8, 9, 10 };
            var result = a.Difference(b);

            Assert.AreEqual(expected.Count(), result.Count());
            for (int x = 0; x < expected.Count(); ++x)
                Assert.AreEqual(expected.ElementAt(x), result.ElementAt(x));
        }
Пример #5
0
        public void CollectionExtensions_Set_Difference()
        {
            var a = new[] { 1, 2, 3, 4, 5, 6, 7 };
            var b = new[] { 4, 5, 6, 7, 8, 9, 10 };
            var expected = new[] { 1, 2, 3, 8, 9, 10 };

            var result = a.Difference(b);

            Assert.IsTrue(expected.SequenceEqual(result));
        }