コード例 #1
0
        public async Task Should_Return_400_Status_Code_With_Invalid_ViewModel()
        {
            // Arrange
            var data = new AbilityViewModel();

            var abilitiesController = new AbilitiesController(abilityServices.Object);

            // Act
            var response = await abilitiesController.Create(data);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <BadRequestObjectResult>(response.Result);
        }
コード例 #2
0
        public async Task Should_Return_201_Status_Code_With_Valid_ViewModel()
        {
            // var actionValue = Assert.IsAssignableFrom<IEnumerable<CustomerAddressViewModel>>(actionResult.Value);
            // Arrange
            var data = BogusViewModel.AbilityViewModelFaker();

            abilityServices.Setup(x => x.CreateAbility(data)).ReturnsAsync(data);

            var abilitiesController = new AbilitiesController(abilityServices.Object);

            // Act
            var response = await abilitiesController.Create(data);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <CreatedResult>(response.Result);
        }