示例#1
0
        public void AsyncProcessorShouldProcess()
        {
            // Arrange
            var  waitHandle = new ManualResetEvent(false);
            bool result     = false;

            var sut = new TestProcessor();

            sut.Complete += (o, e) =>
            {
                waitHandle.Set();
                result = e.Result;
            };

            // Act
            Assert.IsFalse(sut.Processed);
            sut.ProcessAsync(123);

            // Assert
            bool handleSet = waitHandle.WaitOne();

            Assert.IsTrue(handleSet);
            ////Assert.IsTrue(result);  // This fails when run within Suite-Run
            Assert.IsTrue(sut.Processed);
        }
示例#2
0
        public void AsyncProcessorShouldProcess()
        {
            // Arrange
            var waitHandle = new ManualResetEvent(false);

            var sut = new TestProcessor();
            sut.Complete += delegate
            {
                waitHandle.Set();
            };

            // Act
            Assert.IsFalse(sut.Processed);
            sut.ProcessAsync();

            // Assert
            bool handleSet = waitHandle.WaitOne();
            Assert.IsTrue(handleSet);
            Assert.IsTrue(sut.Processed);
        }
示例#3
0
        public void AsyncProcessorShouldProcess()
        {
            // Arrange
            var waitHandle = new ManualResetEvent(false);

            var sut = new TestProcessor();

            sut.Complete += delegate
            {
                waitHandle.Set();
            };

            // Act
            Assert.IsFalse(sut.Processed);
            sut.ProcessAsync();

            // Assert
            bool handleSet = waitHandle.WaitOne();

            Assert.IsTrue(handleSet);
            Assert.IsTrue(sut.Processed);
        }