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 ApiPostTypeRequestModel(); createModel.SetProperties("B"); CreateResponse <ApiPostTypeResponseModel> createResult = await client.PostTypeCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiPostTypeResponseModel getResponse = await client.PostTypeGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.PostTypeDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiPostTypeResponseModel verifyResponse = await client.PostTypeGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiPostTypeResponseModel> CreateRecord(ApiClient client) { var model = new ApiPostTypeRequestModel(); model.SetProperties("B"); CreateResponse <ApiPostTypeResponseModel> result = await client.PostTypeCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLPostTypeMapper(); ApiPostTypeRequestModel model = new ApiPostTypeRequestModel(); model.SetProperties("A"); BOPostType response = mapper.MapModelToBO(1, model); response.Type.Should().Be("A"); }
public void MapRequestToResponse() { var mapper = new ApiPostTypeModelMapper(); var model = new ApiPostTypeRequestModel(); model.SetProperties("A"); ApiPostTypeResponseModel response = mapper.MapRequestToResponse(1, model); response.Id.Should().Be(1); response.Type.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiPostTypeModelMapper(); var model = new ApiPostTypeRequestModel(); model.SetProperties("A"); JsonPatchDocument <ApiPostTypeRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPostTypeRequestModel(); patch.ApplyTo(response); response.Type.Should().Be("A"); }