public async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); var createModel = new ApiCountryRequestModel(); createModel.SetProperties("B"); CreateResponse <ApiCountryResponseModel> createResult = await client.CountryCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiCountryResponseModel getResponse = await client.CountryGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.CountryDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiCountryResponseModel verifyResponse = await client.CountryGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiCountryResponseModel> CreateRecord(ApiClient client) { var model = new ApiCountryRequestModel(); model.SetProperties("B"); CreateResponse <ApiCountryResponseModel> result = await client.CountryCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLCountryMapper(); ApiCountryRequestModel model = new ApiCountryRequestModel(); model.SetProperties("A"); BOCountry response = mapper.MapModelToBO(1, model); response.Name.Should().Be("A"); }
public void MapRequestToResponse() { var mapper = new ApiCountryModelMapper(); var model = new ApiCountryRequestModel(); model.SetProperties("A"); ApiCountryResponseModel response = mapper.MapRequestToResponse(1, model); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiCountryModelMapper(); var model = new ApiCountryRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiCountryRequestModel> patch = mapper.CreatePatch(model); var response = new ApiCountryRequestModel(); patch.ApplyTo(response); response.Name.Should().Be("A"); }