コード例 #1
0
        public async void Should_ReturnStatusCode500_When_InsertingShoppingListWithNull()
        {
            var options = ReturnDbContextOptions("Should_ReturnStatusCode500_When_InsertingShoppingListWithNull");

            // Arrange
            using (var context = new ShoppingListContext(options))
            {
                var sut = new ShoppingListController(new Repository(context));

                // Act
                var result = await sut.InsertShoppingListAsync(null);

                // Assert
                var objectResult = result as ObjectResult;
                Assert.Equal(500, objectResult.StatusCode);
            }
        }
コード例 #2
0
        public async void Should_ReturnStatusCode200_When_InsertingOneShoppingList()
        {
            var options = ReturnDbContextOptions("Should_ReturnStatusCode200_When_InsertingOneShoppingList");

            // Arrange
            using (var context = new ShoppingListContext(options))
            {
                var sut = new ShoppingListController(new Repository(context));

                // Act
                var result = await sut.InsertShoppingListAsync(
                    new ShoppingList { Name = "Test", BudgetSum = 50 });

                // Assert
                var objectResult = result as ObjectResult;
                Assert.IsType <OkObjectResult>(result);
            }
        }