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 ApiMessageRequestModel(); createModel.SetProperties("B", 1); CreateResponse <ApiMessageResponseModel> createResult = await client.MessageCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiMessageResponseModel getResponse = await client.MessageGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.MessageDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiMessageResponseModel verifyResponse = await client.MessageGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiMessageResponseModel> CreateRecord(ApiClient client) { var model = new ApiMessageRequestModel(); model.SetProperties("B", 1); CreateResponse <ApiMessageResponseModel> result = await client.MessageCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLMessageMapper(); ApiMessageRequestModel model = new ApiMessageRequestModel(); model.SetProperties("A", 1); BOMessage response = mapper.MapModelToBO(1, model); response.Content.Should().Be("A"); response.SenderUserId.Should().Be(1); }
public void MapRequestToResponse() { var mapper = new ApiMessageModelMapper(); var model = new ApiMessageRequestModel(); model.SetProperties("A", 1); ApiMessageResponseModel response = mapper.MapRequestToResponse(1, model); response.Content.Should().Be("A"); response.MessageId.Should().Be(1); response.SenderUserId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiMessageModelMapper(); var model = new ApiMessageRequestModel(); model.SetProperties("A", 1); JsonPatchDocument <ApiMessageRequestModel> patch = mapper.CreatePatch(model); var response = new ApiMessageRequestModel(); patch.ApplyTo(response); response.Content.Should().Be("A"); response.SenderUserId.Should().Be(1); }