public async Task Save_ReturnsCreatedResult() { //Arrange var str = "file"; DecisionWrapperDTO decisionWrapperDTO = new DecisionWrapperDTO() { Decision = new DecisionDTO() { Organization = new OrganizationDTO { OrganizationName = str } } }; _decisionService .Setup(x => x.SaveDecisionAsync(decisionWrapperDTO)) .ReturnsAsync(decisionWrapperDTO.Decision.ID); _decisionService .Setup(x => x.GetDecisionOrganizationAsync(decisionWrapperDTO.Decision.Organization)) .ReturnsAsync(decisionWrapperDTO.Decision.Organization); //Act var result = await _decisionsController.Save(decisionWrapperDTO); //Assert _decisionService.Verify(); Assert.IsNotNull(result); Assert.IsInstanceOf <ObjectResult>(result); }
public async Task Save_ReturnsCreatedResult() { //Arrange var governingBodyName = "SomeName"; DecisionWrapperDTO decisionWrapperDTO = new DecisionWrapperDTO() { Decision = new DecisionDTO() { GoverningBody = new GoverningBodyDTO { GoverningBodyName = governingBodyName } } }; _decisionService .Setup(x => x.SaveDecisionAsync(decisionWrapperDTO)) .ReturnsAsync(decisionWrapperDTO.Decision.ID); _decisionService .Setup(x => x.GetDecisionOrganizationAsync(decisionWrapperDTO.Decision.GoverningBody)) .ReturnsAsync(decisionWrapperDTO.Decision.GoverningBody); //Act var result = await _decisionsController.Save(decisionWrapperDTO); //Assert _decisionService.Verify(); Assert.IsNotNull(result); Assert.IsInstanceOf <ObjectResult>(result); }