Пример #1
0
        public void Should_be_possible_to_execute_UNION_operation_on_two_sets_of_referenceTypes_with_null_reference_types()
        {
            IEnumerable<string> firstReferences = new List<string>() { "10", "20" };
            IEnumerable<string> secondReferences = new List<string>();

            SetOperation operation = new UnionSetOperation();
            IEnumerable<string> results = operation.Execute(firstReferences, secondReferences);
            Assert.AreEqual(2, results.Count(), "the quantity of elements is no expected");
        }
Пример #2
0
        public void Should_be_possible_to_define_the_object_flag_based_on_the_objects_of_set_for_the_Union_operator()
        {
            FlagEnumeration firstObjectFlag = FlagEnumeration.error;
            FlagEnumeration secondObjectFlag = FlagEnumeration.error;

            SetOperation operation = new UnionSetOperation();
            FlagEnumeration result = operation.GetObjectFlag(firstObjectFlag, secondObjectFlag);
            Assert.AreEqual(FlagEnumeration.error,result,"the flag enumaration is not expected");

            firstObjectFlag = FlagEnumeration.doesnotexist;
            secondObjectFlag = FlagEnumeration.incomplete;

            operation = new UnionSetOperation();
            result = operation.GetObjectFlag(firstObjectFlag, secondObjectFlag);
            Assert.AreEqual(FlagEnumeration.incomplete, result, "the flag enumaration is not expected");
        }
Пример #3
0
        public void Should_be_possible_to_execute_UNION_operation_on_two_sets_of_referenceTypes_eliminating_duplicate_elements()
        {
            IEnumerable<string> firstReferences = new List<string>() { "10", "20" };
            IEnumerable<string> secondReferences = new List<string>() { "50", "20" };

            SetOperation operation = new UnionSetOperation();
            IEnumerable<string> results = operation.Execute(firstReferences, secondReferences);
            Assert.AreEqual(3, results.Count(), "the quantity of elements is no expected");

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