Example #1
0
        public void Should_be_possible_to_get_an_empty_set_if_an_empty_list_was_informed_for_intersection_operation()
        {
            IEnumerable <string> firstReferences = new List <string>()
            {
                "10", "20", "40", "60"
            };
            IEnumerable <string> secondReferences = new List <string>();

            SetOperation         operation = new IntersectionSetOperation();
            IEnumerable <string> results   = operation.Execute(firstReferences, secondReferences);

            Assert.AreEqual(0, results.Count());
        }
Example #2
0
        public void Should_be_possible_to_define_the_object_flag_based_on_the_objects_of_set_for_the_intersection_operator()
        {
            FlagEnumeration firstObjectFlag  = FlagEnumeration.error;
            FlagEnumeration secondObjectFlag = FlagEnumeration.complete;

            SetOperation    operation = new IntersectionSetOperation();
            FlagEnumeration result    = operation.GetObjectFlag(firstObjectFlag, secondObjectFlag);

            Assert.AreEqual(FlagEnumeration.error, result, "the flag enumaration is not expected");


            firstObjectFlag  = FlagEnumeration.doesnotexist;
            secondObjectFlag = FlagEnumeration.notcollected;
            result           = operation.GetObjectFlag(firstObjectFlag, secondObjectFlag);
            Assert.AreEqual(FlagEnumeration.doesnotexist, result, "the flag enumaration is not expected");
        }
Example #3
0
        public void Should_be_possible_to_get_an_empty_set_if_not_exists_intersection_between_two_sets()
        {
            IEnumerable <string> firstReferences = new List <string>()
            {
                "10", "20", "40", "60"
            };
            IEnumerable <string> secondReferences = new List <string>()
            {
                "180", "80"
            };

            SetOperation         operation = new IntersectionSetOperation();
            IEnumerable <string> results   = operation.Execute(firstReferences, secondReferences);

            Assert.AreEqual(0, results.Count());
        }
Example #4
0
        public void Should_be_possible_to_get_an_intersection_between_two_sets()
        {
            IEnumerable <string> firstReferences = new List <string>()
            {
                "10", "20", "40", "60"
            };
            IEnumerable <string> secondReferences = new List <string>()
            {
                "20", "60"
            };

            SetOperation         operation = new IntersectionSetOperation();
            IEnumerable <string> results   = operation.Execute(firstReferences, secondReferences);

            Assert.AreEqual(2, results.Count());

            string element = results.Where <string>(item => item == "20").SingleOrDefault();

            Assert.IsNotNull(element, "the element expected is not exits");
            element = results.Where <string>(item => item == "60").SingleOrDefault();
            Assert.IsNotNull(element, "the element expected is not exits");
        }