Exemple #1
0
        public static async Task CatchException <T>(this IAsyncRequest <T> command, TestContextFixture testContextFixture, Type exception)
        {
            try
            {
                await testContextFixture.SendAsync(command);
            }

            catch (Exception p)
            {
                p.ShouldBeOfType(exception);
            }
        }
Exemple #2
0
        public async Task GetStock(TestContextFixture testContextFixture, Stock stock, GetStock.Query getStock)
        {
            //arrange
            testContextFixture.SaveAll(stock);
            getStock.CurrencyCode = stock.CurrencyCode;
            getStock.IsinCode     = stock.IsinCode;

            //act
            var result = await testContextFixture.SendAsync(getStock);

            //assert
            result.Name.ShouldBe(stock.Name);
        }
Exemple #3
0
        public void ConcurrentUserNameChanged_ShouldThrow(TestContextFixture testContextFixture,
                                                          User user, UpdateUser.Command updateUser)
        {
            //arrange
            testContextFixture.Save(user);
            user.FirstName = "Piet";
            testContextFixture.DoClean(db =>
                                       db.Database.ExecuteSqlCommand("UPDATE dbo.Users set firstname='Karel'")
                                       );

            //act & assert
            Should.Throw <DbUpdateConcurrencyException>(() =>
                                                        testContextFixture.SendAsync(updateUser)
                                                        );
        }