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 ApiSelfReferenceRequestModel(); createModel.SetProperties(2, 2); CreateResponse <ApiSelfReferenceResponseModel> createResult = await client.SelfReferenceCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiSelfReferenceResponseModel getResponse = await client.SelfReferenceGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.SelfReferenceDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiSelfReferenceResponseModel verifyResponse = await client.SelfReferenceGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiSelfReferenceResponseModel> CreateRecord() { var model = new ApiSelfReferenceRequestModel(); model.SetProperties(2, 2); CreateResponse <ApiSelfReferenceResponseModel> result = await this.Client.SelfReferenceCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLSelfReferenceMapper(); ApiSelfReferenceRequestModel model = new ApiSelfReferenceRequestModel(); model.SetProperties(1, 1); BOSelfReference response = mapper.MapModelToBO(1, model); response.SelfReferenceId.Should().Be(1); response.SelfReferenceId2.Should().Be(1); }
public void MapRequestToResponse() { var mapper = new ApiSelfReferenceModelMapper(); var model = new ApiSelfReferenceRequestModel(); model.SetProperties(1, 1); ApiSelfReferenceResponseModel response = mapper.MapRequestToResponse(1, model); response.Id.Should().Be(1); response.SelfReferenceId.Should().Be(1); response.SelfReferenceId2.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiSelfReferenceModelMapper(); var model = new ApiSelfReferenceRequestModel(); model.SetProperties(1, 1); JsonPatchDocument <ApiSelfReferenceRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSelfReferenceRequestModel(); patch.ApplyTo(response); response.SelfReferenceId.Should().Be(1); response.SelfReferenceId2.Should().Be(1); }