public void Then_If_Null_Then_Null_Returned() { //Arrange var response = new VerifyEmployerDemandCommandResult { EmployerDemand = null }; //Act var actual = (VerifyCourseDemandResponse)response; //Assert actual.Should().BeNull(); }
public void Then_The_Fields_Are_Mapped(VerifyEmployerDemandCommandResult source) { //Act var actual = (VerifyCourseDemandResponse)source; //Assert actual.Id.Should().Be(source.EmployerDemand.Id); actual.OrganisationName.Should().Be(source.EmployerDemand.OrganisationName); actual.ContactEmail.Should().Be(source.EmployerDemand.ContactEmailAddress); actual.EmailVerified.Should().Be(source.EmployerDemand.EmailVerified); actual.NumberOfApprentices.Should().Be(source.EmployerDemand.NumberOfApprentices); actual.Location.Name.Should().Be(source.EmployerDemand.Location.Name); actual.Location.Location.GeoPoint.Should().BeEquivalentTo(source.EmployerDemand.Location.LocationPoint.GeoPoint); actual.TrainingCourse.Id.Should().Be(source.EmployerDemand.Course.Id); actual.TrainingCourse.Title.Should().Be(source.EmployerDemand.Course.Title); actual.TrainingCourse.Level.Should().Be(source.EmployerDemand.Course.Level); actual.TrainingCourse.Route.Should().Be(source.EmployerDemand.Course.Route); }
public async Task Then_The_Command_Is_Processed_By_Mediator_And_Id_Returned( Guid id, VerifyEmployerDemandCommandResult response, [Frozen] Mock <IMediator> mockMediator, [Greedy] DemandController controller) { mockMediator .Setup(mediator => mediator.Send( It.Is <VerifyEmployerDemandCommand>(command => command.Id == id ), It.IsAny <CancellationToken>())).ReturnsAsync(response); var controllerResult = await controller.VerifyCourseDemand(id) as CreatedResult; controllerResult !.StatusCode.Should().Be((int)HttpStatusCode.Created); var actualModel = controllerResult.Value as VerifyCourseDemandResponse; Assert.IsNotNull(actualModel); actualModel.Id.Should().Be(response.EmployerDemand.Id); }