Example #1
0
        static void Main(string[] args)
        {
            // First create a test set - to run/test this
            // per TDD - This should ideally be part of a unit test
            // However, since this was written in Visual Studio Code - a free version of developer tools - I am not entirely sure how to setup a test stack in here, so a console app will do.
            Testlet tl = new Testlet("First Test", new List <Item>()
            {
                new Item()
                {
                    ItemId = "PreTest Item 1", ItemType = ItemTypeEnum.Pretest
                },
                new Item()
                {
                    ItemId = "PreTest Item 2", ItemType = ItemTypeEnum.Pretest
                },
                new Item()
                {
                    ItemId = "PreTest Item 3", ItemType = ItemTypeEnum.Pretest
                },
                new Item()
                {
                    ItemId = "PreTest Item 4", ItemType = ItemTypeEnum.Pretest
                },

                new Item()
                {
                    ItemId = "Operational Item 1", ItemType = ItemTypeEnum.Operational
                },
                new Item()
                {
                    ItemId = "Operational Item 2", ItemType = ItemTypeEnum.Operational
                },
                new Item()
                {
                    ItemId = "Operational Item 3", ItemType = ItemTypeEnum.Operational
                },
                new Item()
                {
                    ItemId = "Operational Item 4", ItemType = ItemTypeEnum.Operational
                },
                new Item()
                {
                    ItemId = "Operational Item 5", ItemType = ItemTypeEnum.Operational
                },
                new Item()
                {
                    ItemId = "Operational Item 6", ItemType = ItemTypeEnum.Operational
                }
            });

            var randomizedlist = tl.Randomize();

            foreach (var item in randomizedlist)
            {
                Console.WriteLine($"ItemId = {item.ItemId} ; ItemType = {item.ItemType}");
            }
        }
        public void TestRandomize()
        {
            Testlet.Testlet test = DataList();

            var randomizedlist1 = test.Randomize();
            var randomizedlist2 = test.Randomize();

            //compare that in both lists
            Assert.IsNotNull(randomizedlist1.FirstOrDefault(s => randomizedlist2[randomizedlist1.IndexOf(s)].ItemId != s.ItemId));
        }
Example #3
0
        public void TestRandomize()
        {
            // First create a test set - to run/test this
            // per TDD
            Testlet.Testlet tl = SetupList();

            var randomizedlist1 = tl.Randomize();
            var randomizedlist2 = tl.Randomize();

            //compare that in both lists (after being randomized - there is atleast one item with the same index that is different)
            Assert.IsNotNull(randomizedlist1.FirstOrDefault(s => randomizedlist2[randomizedlist1.IndexOf(s)].ItemId != s.ItemId));
        }
Example #4
0
        public void TestRandomizeControltest()
        {
            // First create a test set - to run/test this
            // per TDD
            Testlet.Testlet tl = SetupList();

            var randomizedlist1 = tl.Randomize();
            var randomizedlist2 = new List <Item>();

            randomizedlist2.AddRange(randomizedlist1);

            //compare that in both lists (copied from the same list - so no items should be different)
            Assert.IsNull(randomizedlist1.FirstOrDefault(s => randomizedlist2[randomizedlist1.IndexOf(s)].ItemId != s.ItemId));
        }