public virtual async void TestByCountryIdFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiProvinceClientResponseModel> response = await client.ByProvinceByCountryId(1); response.Should().NotBeEmpty(); response[0].CountryId.Should().Be(1); response[0].Id.Should().Be(1); response[0].Name.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 ApiVenueServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; IVenueService service = testServer.Host.Services.GetService(typeof(IVenueService)) as IVenueService; ApiVenueServerResponseModel model = await service.Get(1); ApiVenueClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties("B", "B", 1, "B", "B", "B", "B", 1, "B"); UpdateResponse <ApiVenueClientResponseModel> updateResponse = await client.VenueUpdateAsync(model.Id, request); context.Entry(context.Set <Venue>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <Venue>().ToList()[0].Address1.Should().Be("B"); context.Set <Venue>().ToList()[0].Address2.Should().Be("B"); context.Set <Venue>().ToList()[0].AdminId.Should().Be(1); context.Set <Venue>().ToList()[0].Email.Should().Be("B"); context.Set <Venue>().ToList()[0].Facebook.Should().Be("B"); context.Set <Venue>().ToList()[0].Name.Should().Be("B"); context.Set <Venue>().ToList()[0].Phone.Should().Be("B"); context.Set <Venue>().ToList()[0].ProvinceId.Should().Be(1); context.Set <Venue>().ToList()[0].Website.Should().Be("B"); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.Address1.Should().Be("B"); updateResponse.Record.Address2.Should().Be("B"); updateResponse.Record.AdminId.Should().Be(1); updateResponse.Record.Email.Should().Be("B"); updateResponse.Record.Facebook.Should().Be("B"); updateResponse.Record.Name.Should().Be("B"); updateResponse.Record.Phone.Should().Be("B"); updateResponse.Record.ProvinceId.Should().Be(1); updateResponse.Record.Website.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 <ApiCityClientResponseModel> response = await client.CityAllAsync(); response.Count.Should().BeGreaterThan(0); response[0].Id.Should().Be(1); response[0].Name.Should().Be("A"); response[0].ProvinceId.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; ApiCountryClientResponseModel response = await client.CountryGetAsync(1); response.Should().NotBeNull(); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual async void TestByTransactionStatusIdFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiTransactionClientResponseModel> response = await client.ByTransactionByTransactionStatusId(1); response.Should().NotBeEmpty(); response[0].Amount.Should().Be(1m); response[0].GatewayConfirmationNumber.Should().Be("A"); response[0].Id.Should().Be(1); response[0].TransactionStatusId.Should().Be(1); }
public virtual async void TestByTransactionIdFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiSaleClientResponseModel> response = await client.BySaleByTransactionId(1); response.Should().NotBeEmpty(); response[0].Id.Should().Be(1); response[0].IpAddress.Should().Be("A"); response[0].Notes.Should().Be("A"); response[0].SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response[0].TransactionId.Should().Be(1); }
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 ApiAdminClientRequestModel(); model.SetProperties("B", "B", "B", "B", "B", "B"); var model2 = new ApiAdminClientRequestModel(); model2.SetProperties("C", "C", "C", "C", "C", "C"); var request = new List <ApiAdminClientRequestModel>() { model, model2 }; CreateResponse <List <ApiAdminClientResponseModel> > result = await client.AdminBulkInsertAsync(request); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Admin>().ToList()[1].Email.Should().Be("B"); context.Set <Admin>().ToList()[1].FirstName.Should().Be("B"); context.Set <Admin>().ToList()[1].LastName.Should().Be("B"); context.Set <Admin>().ToList()[1].Password.Should().Be("B"); context.Set <Admin>().ToList()[1].Phone.Should().Be("B"); context.Set <Admin>().ToList()[1].Username.Should().Be("B"); context.Set <Admin>().ToList()[2].Email.Should().Be("C"); context.Set <Admin>().ToList()[2].FirstName.Should().Be("C"); context.Set <Admin>().ToList()[2].LastName.Should().Be("C"); context.Set <Admin>().ToList()[2].Password.Should().Be("C"); context.Set <Admin>().ToList()[2].Phone.Should().Be("C"); context.Set <Admin>().ToList()[2].Username.Should().Be("C"); }
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; ApiSaleClientResponseModel response = await client.SaleGetAsync(1); response.Should().NotBeNull(); response.Id.Should().Be(1); response.IpAddress.Should().Be("A"); response.Notes.Should().Be("A"); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionId.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 ApiEventClientRequestModel(); model.SetProperties("B", "B", 1, DateTime.Parse("1/1/1988 12:00:00 AM"), "B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B", "B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B"); CreateResponse <ApiEventClientResponseModel> result = await client.EventCreateAsync(model); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Event>().ToList()[1].Address1.Should().Be("B"); context.Set <Event>().ToList()[1].Address2.Should().Be("B"); context.Set <Event>().ToList()[1].CityId.Should().Be(1); context.Set <Event>().ToList()[1].Date.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Event>().ToList()[1].Description.Should().Be("B"); context.Set <Event>().ToList()[1].EndDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Event>().ToList()[1].Facebook.Should().Be("B"); context.Set <Event>().ToList()[1].Name.Should().Be("B"); context.Set <Event>().ToList()[1].StartDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Event>().ToList()[1].Website.Should().Be("B"); result.Record.Address1.Should().Be("B"); result.Record.Address2.Should().Be("B"); result.Record.CityId.Should().Be(1); result.Record.Date.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); result.Record.Description.Should().Be("B"); result.Record.EndDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); result.Record.Facebook.Should().Be("B"); result.Record.Name.Should().Be("B"); result.Record.StartDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); result.Record.Website.Should().Be("B"); }
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 ApiCountryClientRequestModel(); model.SetProperties("B"); CreateResponse <ApiCountryClientResponseModel> result = await client.CountryCreateAsync(model); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Country>().ToList()[1].Name.Should().Be("B"); result.Record.Name.Should().Be("B"); }
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 ApiVenueClientRequestModel(); model.SetProperties("B", "B", 1, "B", "B", "B", "B", 1, "B"); CreateResponse <ApiVenueClientResponseModel> result = await client.VenueCreateAsync(model); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Venue>().ToList()[1].Address1.Should().Be("B"); context.Set <Venue>().ToList()[1].Address2.Should().Be("B"); context.Set <Venue>().ToList()[1].AdminId.Should().Be(1); context.Set <Venue>().ToList()[1].Email.Should().Be("B"); context.Set <Venue>().ToList()[1].Facebook.Should().Be("B"); context.Set <Venue>().ToList()[1].Name.Should().Be("B"); context.Set <Venue>().ToList()[1].Phone.Should().Be("B"); context.Set <Venue>().ToList()[1].ProvinceId.Should().Be(1); context.Set <Venue>().ToList()[1].Website.Should().Be("B"); result.Record.Address1.Should().Be("B"); result.Record.Address2.Should().Be("B"); result.Record.AdminId.Should().Be(1); result.Record.Email.Should().Be("B"); result.Record.Facebook.Should().Be("B"); result.Record.Name.Should().Be("B"); result.Record.Phone.Should().Be("B"); result.Record.ProvinceId.Should().Be(1); result.Record.Website.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 ApiSaleClientRequestModel(); model.SetProperties("B", "B", DateTime.Parse("1/1/1988 12:00:00 AM"), 1); var model2 = new ApiSaleClientRequestModel(); model2.SetProperties("C", "C", DateTime.Parse("1/1/1989 12:00:00 AM"), 1); var request = new List <ApiSaleClientRequestModel>() { model, model2 }; CreateResponse <List <ApiSaleClientResponseModel> > result = await client.SaleBulkInsertAsync(request); result.Success.Should().BeTrue(); result.Record.Should().NotBeNull(); context.Set <Sale>().ToList()[1].IpAddress.Should().Be("B"); context.Set <Sale>().ToList()[1].Notes.Should().Be("B"); context.Set <Sale>().ToList()[1].SaleDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Sale>().ToList()[1].TransactionId.Should().Be(1); context.Set <Sale>().ToList()[2].IpAddress.Should().Be("C"); context.Set <Sale>().ToList()[2].Notes.Should().Be("C"); context.Set <Sale>().ToList()[2].SaleDate.Should().Be(DateTime.Parse("1/1/1989 12:00:00 AM")); context.Set <Sale>().ToList()[2].TransactionId.Should().Be(1); }
public virtual async void TestByProvinceIdFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); List <ApiVenueClientResponseModel> response = await client.ByVenueByProvinceId(1); response.Should().NotBeEmpty(); response[0].Address1.Should().Be("A"); response[0].Address2.Should().Be("A"); response[0].AdminId.Should().Be(1); response[0].Email.Should().Be("A"); response[0].Facebook.Should().Be("A"); response[0].Id.Should().Be(1); response[0].Name.Should().Be("A"); response[0].Phone.Should().Be("A"); response[0].ProvinceId.Should().Be(1); response[0].Website.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 ApiSaleServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ISaleService service = testServer.Host.Services.GetService(typeof(ISaleService)) as ISaleService; ApiSaleServerResponseModel model = await service.Get(1); ApiSaleClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties("B", "B", DateTime.Parse("1/1/1988 12:00:00 AM"), 1); UpdateResponse <ApiSaleClientResponseModel> updateResponse = await client.SaleUpdateAsync(model.Id, request); context.Entry(context.Set <Sale>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <Sale>().ToList()[0].IpAddress.Should().Be("B"); context.Set <Sale>().ToList()[0].Notes.Should().Be("B"); context.Set <Sale>().ToList()[0].SaleDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Sale>().ToList()[0].TransactionId.Should().Be(1); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.IpAddress.Should().Be("B"); updateResponse.Record.Notes.Should().Be("B"); updateResponse.Record.SaleDate.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.TransactionId.Should().Be(1); }