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; ApiStudentClientResponseModel response = await client.StudentGetAsync(1); response.Should().NotBeNull(); response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Email.Should().Be("A"); response.EmailRemindersEnabled.Should().Be(true); response.FamilyId.Should().Be(1); response.FirstName.Should().Be("A"); response.Id.Should().Be(1); response.IsAdult.Should().Be(true); response.LastName.Should().Be("A"); response.Phone.Should().Be("A"); response.SmsRemindersEnabled.Should().Be(true); response.UserId.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()); ApiStudentClientResponseModel response = await client.StudentGetAsync(default(int)); response.Should().BeNull(); }
public void MapClientResponseToRequest() { var mapper = new ApiStudentModelMapper(); var model = new ApiStudentClientResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", true, 1, "A", true, "A", "A", true, 1); ApiStudentClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Email.Should().Be("A"); response.EmailRemindersEnabled.Should().Be(true); response.FamilyId.Should().Be(1); response.FirstName.Should().Be("A"); response.IsAdult.Should().Be(true); response.LastName.Should().Be("A"); response.Phone.Should().Be("A"); response.SmsRemindersEnabled.Should().Be(true); response.UserId.Should().Be(1); }