コード例 #1
0
 public void WhenErrorIsThrownWillRollbackTransaction()
 {
     OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.Throw);
     fibonaci.Execute();
     Assert.AreEqual(1, new List<Exception>(fibonaci.GetAllErrors()).Count);
     AssertFibonacciTableEmpty();
 }
コード例 #2
0
        public void CanInsertToDatabaseFromInMemoryCollection()
        {
            OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.WorkFine);
            fibonaci.Execute();

            Assert25ThFibonacci();
        }
コード例 #3
0
        public void WhenErrorIsThrownWillRollbackTransaction()
        {
            OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.Throw);

            fibonaci.Execute();
            Assert.Equal(1, new List <Exception>(fibonaci.GetAllErrors()).Count);
            AssertFibonacciTableEmpty();
        }
コード例 #4
0
        public void CanInsertToDatabaseFromInMemoryCollection()
        {
            OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.WorkFine);

            fibonaci.Execute();

            Assert25ThFibonacci();
        }
コード例 #5
0
        public async Task CanInsertToDatabaseFromInMemoryCollection()
        {
            await EnsureFibonacciTableExists();

            OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.WorkFine);
            await fibonaci.Execute();

            await Assert25ThFibonacci();
        }
コード例 #6
0
        public void CanInsertToDatabaseFromConnectionStringSettingsAndInMemoryCollection()
        {
            using (var fibonacci = new OutputFibonacciToDatabase(TestDatabase.ConnectionString, 25, Should.WorkFine))
            {
                fibonacci.Execute();
            }

            Assert25ThFibonacci();
        }
コード例 #7
0
        public async Task WhenErrorIsThrownWillRollbackTransaction()
        {
            await EnsureFibonacciTableExists();

            OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.Throw);
            await fibonaci.Execute();

            Assert.Single(new List <Exception>(fibonaci.GetAllErrors()));
            await AssertFibonacciTableEmpty();
        }
コード例 #8
0
        public void WhenErrorIsThrownWillRollbackTransaction()
        {
            using (var fibonacci = new OutputFibonacciToDatabase(TestDatabase.ConnectionStringName, 25, Should.Throw))
            {
                fibonacci.Execute();
                Assert.Single(new List <Exception>(fibonacci.GetAllErrors()));
            }

            AssertFibonacciTableEmpty();
        }
コード例 #9
0
        public void WillRaiseRowProcessedEvent()
        {
            int rowsProcessed = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(1, Should.WorkFine))
            {
                fibonaci.OutputOperation.OnRowProcessed += delegate { rowsProcessed++; };
                fibonaci.Execute();
            }

            Assert.Equal(1, rowsProcessed);
        }
コード例 #10
0
        public void WillRaiseFinishedProcessingEventOnce()
        {
            int finished = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(1, Should.WorkFine))
            {
                fibonaci.OutputOperation.OnFinishedProcessing += delegate { finished++; };
                fibonaci.Execute();
            }

            Assert.AreEqual(1, finished);
        }
コード例 #11
0
        public void WillRaiseRowProcessedEvent()
        {
            int rowsProcessed = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(1, Should.WorkFine))
            {
                fibonaci.OutputOperation.OnRowProcessed += delegate { rowsProcessed++; };
                fibonaci.Execute();
            }

            Assert.AreEqual(1, rowsProcessed);
        }
コード例 #12
0
        public void WillRaiseFinishedProcessingEventOnce()
        {
            int finished = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(1, Should.WorkFine))
            {
                fibonaci.OutputOperation.OnFinishedProcessing += delegate { finished++; };
                fibonaci.Execute();
            }

            Assert.Equal(1, finished);
        }
コード例 #13
0
        public void WillRaiseRowProcessedEventUntilItThrows()
        {
            int rowsProcessed = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.Throw))
            {
                fibonaci.OutputOperation.OnRowProcessed += delegate { rowsProcessed++; };
                fibonaci.Execute();

                Assert.Equal(fibonaci.ThrowingOperation.RowsAfterWhichToThrow, rowsProcessed);
            }
        }
コード例 #14
0
        public void WillRaiseRowProcessedEventUntilItThrows()
        {
            int rowsProcessed = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.Throw))
            {
                fibonaci.OutputOperation.OnRowProcessed += delegate { rowsProcessed++; };
                fibonaci.Execute();

                Assert.AreEqual(fibonaci.ThrowingOperation.RowsAfterWhichToThrow, rowsProcessed);
            }
        }
コード例 #15
0
        public async Task WillRaiseFinishedProcessingEventOnce()
        {
            await EnsureFibonacciTableExists();

            int finished = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(1, Should.WorkFine))
            {
                fibonaci.OutputOperation.OnFinishedProcessing += delegate { finished++; };
                await fibonaci.Execute();
            }

            Assert.Equal(1, finished);
        }
コード例 #16
0
        public async Task WillRaiseRowProcessedEventUntilItThrows()
        {
            await EnsureFibonacciTableExists();

            int rowsProcessed = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(25, Should.Throw))
            {
                fibonaci.OutputOperation.OnRowProcessed += delegate { rowsProcessed++; };
                await fibonaci.Execute();

                Assert.Equal(fibonaci.ThrowingOperation.RowsAfterWhichToThrow, rowsProcessed);
            }
        }
コード例 #17
0
        public async Task WillRaiseRowProcessedEvent()
        {
            await EnsureFibonacciTableExists();

            int rowsProcessed = 0;

            using (OutputFibonacciToDatabase fibonaci = new OutputFibonacciToDatabase(1, Should.WorkFine))
            {
                fibonaci.OutputOperation.OnRowProcessed += delegate { rowsProcessed++; };
                await fibonaci.Execute();
            }

            Assert.Equal(1, rowsProcessed);
        }