public void MapClientRequestToResponse() { var mapper = new ApiEventTeacherModelMapper(); var model = new ApiEventTeacherClientRequestModel(); model.SetProperties(1, 1); ApiEventTeacherClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.EventId.Should().Be(1); response.TeacherId.Should().Be(1); }
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()); ApiEventTeacherClientResponseModel response = await client.EventTeacherGetAsync(default(int)); response.Should().BeNull(); }
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; ApiEventTeacherClientResponseModel response = await client.EventTeacherGetAsync(1); response.Should().NotBeNull(); response.EventId.Should().Be(1); response.Id.Should().Be(1); response.TeacherId.Should().Be(1); }