Beispiel #1
0
        //bug found in this case.
        public void TestCreateSet_Testforsize()
        {
            //Arrange
            int expResult = 2;
            //Act
            List <int> result = ArraySetUtilities.CreateSet(1, 2, 4, false);

            //Assert
            Assert.AreEqual(expResult, result[0], "it obtains some random values");
        }
Beispiel #2
0
        public void TestIsUnique_unique()
        {
            //Arrange
            List <int> arraySet = new List <int>()
            {
                10, 12, 22, 33, 45, 44, 55, 48, 1
            };
            bool expResult = true; //should be true to execute

            //Act
            bool actualResult = ArraySetUtilities.IsUnique(arraySet);

            //Assert
            Assert.AreEqual(expResult, actualResult, "Unique array test returning false - test array is unique");
        }
Beispiel #3
0
        public void TestCreateSet_CorrectSizeCreated()
        {
            //Arrange
            int  size           = 20;
            int  minimum        = 0;
            int  maximum        = 100;
            bool uniqueElements = false;
            int  expResult      = size;

            //Act
            int result = ArraySetUtilities.CreateSet(size, minimum, maximum, uniqueElements).Count;

            //Assert
            Assert.AreEqual(expResult, result, "incorrect item count");
        }
Beispiel #4
0
        public void TestIntersection_SetASizeZero()
        {
            //Arrange
            List <int> setA = new List <int>();
            List <int> setB = new List <int>()
            {
                10, 12, 22, 33, 45, 44, 55, 48, 1
            };
            //expected exception

            //Act
            List <int> result = ArraySetUtilities.Intersection(setA, setB);

            //Assert
            //no assert equired in this method.
        }
Beispiel #5
0
        public void TestsubSet_subset()
        {
            //Arrange
            List <int> setA = new List <int>()
            {
                33, 45, 44
            };
            List <int> setB = new List <int>()
            {
                10, 12, 22, 33, 45, 44, 55, 48, 1
            };
            bool expResult = false;
            //Act
            bool result = ArraySetUtilities.subSet(setA, setB);

            //Assert
            Assert.AreEqual(expResult, result, "Not a subset");
        }
Beispiel #6
0
        //here no exception required
        public void Testunion_union()
        {
            //Arrange
            List <int> setA = new List <int>()
            {
                2, 6, 8, 9, 11, 44, 77, 55
            };
            List <int> setB = new List <int>()
            {
                10, 12, 22, 33, 45, 44, 55, 48, 1
            };

            int expResult = 2;
            //Act
            List <int> result = ArraySetUtilities.union(setA, setB);

            //Assert
            Assert.AreEqual(expResult, result[0], "union is executed");
        }