예제 #1
0
        public async Task AddRange_ValidCompanies_ReturnsOkOkResult()
        {
            var nameMissingItem = new Company()
            {
                Description = "Description 1"
            };

            var createdResponse = await ControllerUnderTest.AddRange(new[] { nameMissingItem });

            Assert.IsType <OkResult>(createdResponse);
        }
예제 #2
0
        public async Task AddRange_CompanyWithoutName_ReturnsBadRequest()
        {
            var nameMissingItem = new Company()
            {
                Description = "Description 1"
            };

            ControllerUnderTest.ModelState.AddModelError("Name", "Required");

            var badResponse = await ControllerUnderTest.AddRange(new[] { nameMissingItem });

            Assert.IsType <BadRequestObjectResult>(badResponse);
        }