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; ApiSpaceFeatureClientResponseModel response = await client.SpaceFeatureGetAsync(1); response.Should().NotBeNull(); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual async void TestByTeacherSkillIdFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiRateClientResponseModel> response = await client.ByRateByTeacherSkillId(1); response.Should().NotBeEmpty(); response[0].AmountPerMinute.Should().Be(1m); response[0].Id.Should().Be(1); response[0].TeacherId.Should().Be(1); response[0].TeacherSkillId.Should().Be(1); }
public virtual async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); var mapper = new ApiEventServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; IEventService service = testServer.Host.Services.GetService(typeof(IEventService)) as IEventService; ApiEventServerResponseModel model = await service.Get(1); ApiEventClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), 2m, 1, DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), "B", "B"); UpdateResponse <ApiEventClientResponseModel> updateResponse = await client.EventUpdateAsync(model.Id, request); context.Entry(context.Set <Event>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <Event>().ToList()[0].ActualEndDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Event>().ToList()[0].ActualStartDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Event>().ToList()[0].BillAmount.Should().Be(2m); context.Set <Event>().ToList()[0].EventStatusId.Should().Be(1); context.Set <Event>().ToList()[0].ScheduledEndDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Event>().ToList()[0].ScheduledStartDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Event>().ToList()[0].StudentNotes.Should().Be("B"); context.Set <Event>().ToList()[0].TeacherNotes.Should().Be("B"); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.ActualEndDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.ActualStartDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.BillAmount.Should().Be(2m); updateResponse.Record.EventStatusId.Should().Be(1); updateResponse.Record.ScheduledEndDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.ScheduledStartDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.StudentNotes.Should().Be("B"); updateResponse.Record.TeacherNotes.Should().Be("B"); }
public virtual async void TestBulkInsert() { 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; var model = new ApiStudioClientRequestModel(); model.SetProperties("B", "B", "B", "B", "B", "B", "B"); var model2 = new ApiStudioClientRequestModel(); model2.SetProperties("C", "C", "C", "C", "C", "C", "C"); var request = new List <ApiStudioClientRequestModel>() { model, model2 }; CreateResponse <List <ApiStudioClientResponseModel> > result = await client.StudioBulkInsertAsync(request); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Studio>().ToList()[1].Address1.Should().Be("B"); context.Set <Studio>().ToList()[1].Address2.Should().Be("B"); context.Set <Studio>().ToList()[1].City.Should().Be("B"); context.Set <Studio>().ToList()[1].Name.Should().Be("B"); context.Set <Studio>().ToList()[1].Province.Should().Be("B"); context.Set <Studio>().ToList()[1].Website.Should().Be("B"); context.Set <Studio>().ToList()[1].Zip.Should().Be("B"); context.Set <Studio>().ToList()[2].Address1.Should().Be("C"); context.Set <Studio>().ToList()[2].Address2.Should().Be("C"); context.Set <Studio>().ToList()[2].City.Should().Be("C"); context.Set <Studio>().ToList()[2].Name.Should().Be("C"); context.Set <Studio>().ToList()[2].Province.Should().Be("C"); context.Set <Studio>().ToList()[2].Website.Should().Be("C"); context.Set <Studio>().ToList()[2].Zip.Should().Be("C"); }
public virtual async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); var mapper = new ApiStudioServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; IStudioService service = testServer.Host.Services.GetService(typeof(IStudioService)) as IStudioService; ApiStudioServerResponseModel model = await service.Get(1); ApiStudioClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties("B", "B", "B", "B", "B", "B", "B"); UpdateResponse <ApiStudioClientResponseModel> updateResponse = await client.StudioUpdateAsync(model.Id, request); context.Entry(context.Set <Studio>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <Studio>().ToList()[0].Address1.Should().Be("B"); context.Set <Studio>().ToList()[0].Address2.Should().Be("B"); context.Set <Studio>().ToList()[0].City.Should().Be("B"); context.Set <Studio>().ToList()[0].Name.Should().Be("B"); context.Set <Studio>().ToList()[0].Province.Should().Be("B"); context.Set <Studio>().ToList()[0].Website.Should().Be("B"); context.Set <Studio>().ToList()[0].Zip.Should().Be("B"); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.Address1.Should().Be("B"); updateResponse.Record.Address2.Should().Be("B"); updateResponse.Record.City.Should().Be("B"); updateResponse.Record.Name.Should().Be("B"); updateResponse.Record.Province.Should().Be("B"); updateResponse.Record.Website.Should().Be("B"); updateResponse.Record.Zip.Should().Be("B"); }
public virtual async void TestAll() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiFamilyClientResponseModel> response = await client.FamilyAllAsync(); response.Count.Should().BeGreaterThan(0); response[0].Id.Should().Be(1); response[0].Notes.Should().Be("A"); response[0].PrimaryContactEmail.Should().Be("A"); response[0].PrimaryContactFirstName.Should().Be("A"); response[0].PrimaryContactLastName.Should().Be("A"); response[0].PrimaryContactPhone.Should().Be("A"); }
public virtual async void TestBulkInsert() { 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; var model = new ApiTeacherClientRequestModel(); model.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B", "B", "B", "B", 1); var model2 = new ApiTeacherClientRequestModel(); model2.SetProperties(DateTime.Parse("1/1/1989 12:00:00 AM"), "C", "C", "C", "C", 1); var request = new List <ApiTeacherClientRequestModel>() { model, model2 }; CreateResponse <List <ApiTeacherClientResponseModel> > result = await client.TeacherBulkInsertAsync(request); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Teacher>().ToList()[1].Birthday.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Teacher>().ToList()[1].Email.Should().Be("B"); context.Set <Teacher>().ToList()[1].FirstName.Should().Be("B"); context.Set <Teacher>().ToList()[1].LastName.Should().Be("B"); context.Set <Teacher>().ToList()[1].Phone.Should().Be("B"); context.Set <Teacher>().ToList()[1].UserId.Should().Be(1); context.Set <Teacher>().ToList()[2].Birthday.Should().Be(DateTime.Parse("1/1/1989 12:00:00 AM")); context.Set <Teacher>().ToList()[2].Email.Should().Be("C"); context.Set <Teacher>().ToList()[2].FirstName.Should().Be("C"); context.Set <Teacher>().ToList()[2].LastName.Should().Be("C"); context.Set <Teacher>().ToList()[2].Phone.Should().Be("C"); context.Set <Teacher>().ToList()[2].UserId.Should().Be(1); }
public virtual async void TestByUserIdFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiTeacherClientResponseModel> response = await client.ByTeacherByUserId(1); response.Should().NotBeEmpty(); response[0].Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response[0].Email.Should().Be("A"); response[0].FirstName.Should().Be("A"); response[0].Id.Should().Be(1); response[0].LastName.Should().Be("A"); response[0].Phone.Should().Be("A"); response[0].UserId.Should().Be(1); }
public virtual async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); var mapper = new ApiTeacherServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ITeacherService service = testServer.Host.Services.GetService(typeof(ITeacherService)) as ITeacherService; ApiTeacherServerResponseModel model = await service.Get(1); ApiTeacherClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B", "B", "B", "B", 1); UpdateResponse <ApiTeacherClientResponseModel> updateResponse = await client.TeacherUpdateAsync(model.Id, request); context.Entry(context.Set <Teacher>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <Teacher>().ToList()[0].Birthday.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Teacher>().ToList()[0].Email.Should().Be("B"); context.Set <Teacher>().ToList()[0].FirstName.Should().Be("B"); context.Set <Teacher>().ToList()[0].LastName.Should().Be("B"); context.Set <Teacher>().ToList()[0].Phone.Should().Be("B"); context.Set <Teacher>().ToList()[0].UserId.Should().Be(1); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.Birthday.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.Email.Should().Be("B"); updateResponse.Record.FirstName.Should().Be("B"); updateResponse.Record.LastName.Should().Be("B"); updateResponse.Record.Phone.Should().Be("B"); updateResponse.Record.UserId.Should().Be(1); }
public virtual async void TestCreate() { 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; var model = new ApiStudentClientRequestModel(); model.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B", true, 1, "B", true, "B", "B", true, 1); CreateResponse <ApiStudentClientResponseModel> result = await client.StudentCreateAsync(model); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Student>().ToList()[1].Birthday.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Student>().ToList()[1].Email.Should().Be("B"); context.Set <Student>().ToList()[1].EmailRemindersEnabled.Should().Be(true); context.Set <Student>().ToList()[1].FamilyId.Should().Be(1); context.Set <Student>().ToList()[1].FirstName.Should().Be("B"); context.Set <Student>().ToList()[1].IsAdult.Should().Be(true); context.Set <Student>().ToList()[1].LastName.Should().Be("B"); context.Set <Student>().ToList()[1].Phone.Should().Be("B"); context.Set <Student>().ToList()[1].SmsRemindersEnabled.Should().Be(true); context.Set <Student>().ToList()[1].UserId.Should().Be(1); result.Record.Birthday.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); result.Record.Email.Should().Be("B"); result.Record.EmailRemindersEnabled.Should().Be(true); result.Record.FamilyId.Should().Be(1); result.Record.FirstName.Should().Be("B"); result.Record.IsAdult.Should().Be(true); result.Record.LastName.Should().Be("B"); result.Record.Phone.Should().Be("B"); result.Record.SmsRemindersEnabled.Should().Be(true); result.Record.UserId.Should().Be(1); }
public virtual async void TestCreate() { 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; var model = new ApiSpaceFeatureClientRequestModel(); model.SetProperties("B"); CreateResponse <ApiSpaceFeatureClientResponseModel> result = await client.SpaceFeatureCreateAsync(model); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <SpaceFeature>().ToList()[1].Name.Should().Be("B"); result.Record.Name.Should().Be("B"); }
public virtual async void TestAll() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiStudioClientResponseModel> response = await client.StudioAllAsync(); response.Count.Should().BeGreaterThan(0); response[0].Address1.Should().Be("A"); response[0].Address2.Should().Be("A"); response[0].City.Should().Be("A"); response[0].Id.Should().Be(1); response[0].Name.Should().Be("A"); response[0].Province.Should().Be("A"); response[0].Website.Should().Be("A"); response[0].Zip.Should().Be("A"); }
public virtual async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); var mapper = new ApiFamilyServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; IFamilyService service = testServer.Host.Services.GetService(typeof(IFamilyService)) as IFamilyService; ApiFamilyServerResponseModel model = await service.Get(1); ApiFamilyClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties("B", "B", "B", "B", "B"); UpdateResponse <ApiFamilyClientResponseModel> updateResponse = await client.FamilyUpdateAsync(model.Id, request); context.Entry(context.Set <Family>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <Family>().ToList()[0].Notes.Should().Be("B"); context.Set <Family>().ToList()[0].PrimaryContactEmail.Should().Be("B"); context.Set <Family>().ToList()[0].PrimaryContactFirstName.Should().Be("B"); context.Set <Family>().ToList()[0].PrimaryContactLastName.Should().Be("B"); context.Set <Family>().ToList()[0].PrimaryContactPhone.Should().Be("B"); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.Notes.Should().Be("B"); updateResponse.Record.PrimaryContactEmail.Should().Be("B"); updateResponse.Record.PrimaryContactFirstName.Should().Be("B"); updateResponse.Record.PrimaryContactLastName.Should().Be("B"); updateResponse.Record.PrimaryContactPhone.Should().Be("B"); }
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; ApiTeacherClientResponseModel response = await client.TeacherGetAsync(1); response.Should().NotBeNull(); response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Email.Should().Be("A"); response.FirstName.Should().Be("A"); response.Id.Should().Be(1); response.LastName.Should().Be("A"); response.Phone.Should().Be("A"); response.UserId.Should().Be(1); }
public virtual async void TestByEventStatusIdFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiEventClientResponseModel> response = await client.ByEventByEventStatusId(1); response.Should().NotBeEmpty(); response[0].ActualEndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response[0].ActualStartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response[0].BillAmount.Should().Be(1m); response[0].EventStatusId.Should().Be(1); response[0].Id.Should().Be(1); response[0].ScheduledEndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response[0].ScheduledStartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response[0].StudentNotes.Should().Be("A"); response[0].TeacherNotes.Should().Be("A"); }