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 ApiMessengerRequestModel(); createModel.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), 2, 1, TimeSpan.Parse("1"), 1, 1); CreateResponse <ApiMessengerResponseModel> createResult = await client.MessengerCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiMessengerResponseModel getResponse = await client.MessengerGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.MessengerDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiMessengerResponseModel verifyResponse = await client.MessengerGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiMessengerResponseModel> CreateRecord(ApiClient client) { var model = new ApiMessengerRequestModel(); model.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), 2, 1, TimeSpan.Parse("1"), 1, 1); CreateResponse <ApiMessengerResponseModel> result = await client.MessengerCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLMessengerMapper(); ApiMessengerRequestModel model = new ApiMessengerRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, TimeSpan.Parse("0"), 1, 1); BOMessenger response = mapper.MapModelToBO(1, model); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.FromUserId.Should().Be(1); response.MessageId.Should().Be(1); response.Time.Should().Be(TimeSpan.Parse("0")); response.ToUserId.Should().Be(1); response.UserId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiMessengerModelMapper(); var model = new ApiMessengerRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, TimeSpan.Parse("0"), 1, 1); JsonPatchDocument <ApiMessengerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiMessengerRequestModel(); patch.ApplyTo(response); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.FromUserId.Should().Be(1); response.MessageId.Should().Be(1); response.Time.Should().Be(TimeSpan.Parse("0")); response.ToUserId.Should().Be(1); response.UserId.Should().Be(1); }