public virtual async void TestGetNotFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApiNoteClientResponseModel response = await client.NoteGetAsync(default(int)); response.Should().BeNull(); }
public void MapClientResponseToRequest() { var mapper = new ApiNoteModelMapper(); var model = new ApiNoteClientResponseModel(); model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1); ApiNoteClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.CallId.Should().Be(1); response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.NoteText.Should().Be("A"); response.OfficerId.Should().Be(1); }
public virtual async void TestGetFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ApiNoteClientResponseModel response = await client.NoteGetAsync(1); response.Should().NotBeNull(); response.CallId.Should().Be(1); response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Id.Should().Be(1); response.NoteText.Should().Be("A"); response.OfficerId.Should().Be(1); }