public async Task GetTlevelReturnsNotFound() { //Set Up const HttpStatusCode expectedHttpStatusCode = HttpStatusCode.NotFound; const TLevelDetails nullTLevelDetails = null; A.CallTo(() => FakeFindACoursesService.GetTLevelDetails(A <string> .Ignored, A <string> .Ignored)).Returns(nullTLevelDetails); using var controller = BuildDetailsController("*/*"); var paramValues = new ParamValues(); //Act var result = await controller.TLevelDetails(CourseId, TLevelLocationId, "testSearchTerm", paramValues).ConfigureAwait(false); //Asserts var resultStatus = result as StatusCodeResult; resultStatus.StatusCode.Should().Be((int)expectedHttpStatusCode); A.CallTo(() => FakeLogService.LogWarning(A <string> .Ignored)).MustHaveHappenedOnceExactly(); }
public async Task ReturnsNoContentWhenNoData(string mediaTypeName) { // Arrange List <CareerPathSegmentModel> expectedResult = null; var controller = BuildSegmentController(mediaTypeName); A.CallTo(() => FakeCareerPathSegmentService.GetAllAsync()).Returns(expectedResult); // Act var result = await controller.RefreshDocuments().ConfigureAwait(false); // Assert A.CallTo(() => FakeJobProfileSegmentRefreshService.SendMessageListAsync(A <List <RefreshJobProfileSegmentServiceBusModel> > .Ignored)).MustNotHaveHappened(); var statusResult = Assert.IsType <NoContentResult>(result); A.CallTo(() => FakeLogService.LogWarning(A <string> .Ignored)).MustHaveHappenedOnceExactly(); Assert.Equal((int)HttpStatusCode.NoContent, statusResult.StatusCode); controller.Dispose(); }