Example #1
0
        public void Initialize()
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            _haystackOrganizer = new HaystackOrganizer();
            _sortByColorResult = _haystackOrganizer.SortByColor(new eBags.PileOfBeans.Test.Haystack(), new SortByColorResult());
            stopWatch.Stop();
            _timeTaken = stopWatch.ElapsedMilliseconds;
        }
Example #2
0
        public void EmptyTest()
        {
            var haystackOrganizer = new HaystackOrganizer();
            var sortByColorResult = haystackOrganizer.SortByColor(new EmptyHaystack(), new SortByColorResult());
            var reds   = sortByColorResult.SortedHay[Color.Red];
            var greens = sortByColorResult.SortedHay[Color.Green];
            var blues  = sortByColorResult.SortedHay[Color.Blue];

            Assert.AreEqual(0, reds.Values.Count, "Expected to have zero reds");
            Assert.AreEqual(0, greens.Values.Count, "Expected to have zero greens");
            Assert.AreEqual(0, blues.Values.Count, "Expected to have zero greens");
        }
Example #3
0
        public void LoadTest()
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            IHaystackOrganizer haystackOrganizer = new HaystackOrganizer();
            ISortByColorResult sortByColorResult = haystackOrganizer.SortByColor(new eBags.PileOfBeans.Haystack.Haystack(), new SortByColorResult());

            stopWatch.Stop();
            var timeTaken = stopWatch.ElapsedMilliseconds;

            Assert.IsTrue(timeTaken < 10000, "Expected to finish this within 10 seconds");
        }