コード例 #1
0
        public void ShouldProcess100000ItemsFastly()
        {
            // Arrange
            var expected  = 200; // ObservableCollection makes it slower... but still, shouldn't be an issue
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            // Act
            for (int i = 0; i < 100000; i++)
            {
                stack.AddItem(new TestObject(i));
            }

            // Assert
            stopwatch.Stop();

            Assert.IsTrue(stopwatch.ElapsedMilliseconds < expected, "Should be faster than " + expected + " (actual:" + stopwatch.ElapsedMilliseconds + ")");
        }
コード例 #2
0
        public void ShouldProcess100000ItemsFastly()
        {
            //arrange
            var expected = 15;
            var stopw    = new Stopwatch();

            stopw.Start();

            //act
            for (int i = 0; i < 100000; i++)
            {
                stack.AddItem(new TestObject(i));
            }

            //assert
            stopw.Stop();

            Assert.IsTrue(stopw.ElapsedMilliseconds < expected, "Should be faster than " + expected + " (actual:" + stopw.ElapsedMilliseconds + ")");
        }