public async static Task <Store> CreateValidStore() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new StoreRepository(context); var unitOfWork = new EfCoreUnitOfWork(context); var service = new StoreService(repository, unitOfWork); var command = new store.Commands.Create(); command.Name = "New store"; command.Id = null; // Create Store var storeController = new StoreController(service); var storeId = await storeController.Post(command); // Update store name var updateCommand = new store.Commands.SetStoreName(); updateCommand.Id = storeId.Value.Id; updateCommand.Name = "Test market"; await storeController.Put(updateCommand); return(await repository.GetStoreFullAsync(command.Id)); }
public static async Task <Store> CreateValidStore() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new StoreRepository(context); var unitOfWork = new EfCoreUnitOfWork(context); var service = new StoreService(repository, unitOfWork); var newLocation = await LocationHelpers.CreateValidLocation(); var command = new store.Commands.Create { Name = "New store", Id = null, LocationId = newLocation.Id }; // Create Store var storeController = new StoreController(service); await storeController.Post(command); return(await repository.GetAsync(command.Id)); }
public async static Task <dynamic> CreateInvalidStore() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new StoreRepository(context); var unitOfWork = new EfCoreUnitOfWork(context); var service = new StoreService(repository, unitOfWork); var command = new store.Commands.Create(); command.Id = null; // Create Store var storeController = new StoreController(service); return(await storeController.Post(command)); }