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 ApiSchemaBPersonRequestModel(); createModel.SetProperties("B"); CreateResponse <ApiSchemaBPersonResponseModel> createResult = await client.SchemaBPersonCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiSchemaBPersonResponseModel getResponse = await client.SchemaBPersonGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.SchemaBPersonDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiSchemaBPersonResponseModel verifyResponse = await client.SchemaBPersonGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiSchemaBPersonResponseModel> CreateRecord(ApiClient client) { var model = new ApiSchemaBPersonRequestModel(); model.SetProperties("B"); CreateResponse <ApiSchemaBPersonResponseModel> result = await client.SchemaBPersonCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLSchemaBPersonMapper(); ApiSchemaBPersonRequestModel model = new ApiSchemaBPersonRequestModel(); model.SetProperties("A"); BOSchemaBPerson response = mapper.MapModelToBO(1, model); response.Name.Should().Be("A"); }
public void MapRequestToResponse() { var mapper = new ApiSchemaBPersonModelMapper(); var model = new ApiSchemaBPersonRequestModel(); model.SetProperties("A"); ApiSchemaBPersonResponseModel response = mapper.MapRequestToResponse(1, model); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiSchemaBPersonModelMapper(); var model = new ApiSchemaBPersonRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiSchemaBPersonRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSchemaBPersonRequestModel(); patch.ApplyTo(response); response.Name.Should().Be("A"); }