public static async Task <bool> CheckIfProductTypeExists(ProductTypeId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new ProductTypeRepository(context); return(await repository.ExistsAsync(id)); }
public async Task ProductType_inserted_to_database() { ProductType productType = await CreateValidProductType(); var repository = new ProductTypeRepository(fixture.context); var sut = await repository.LoadAsync(productType.Id); Assert.True(await repository.ExistsAsync(sut.Id)); Assert.True(sut.Name.Length > 0); }
public async Task Update_ProductType_name() { ProductType productType = await CreateValidProductType(); var repository = new ProductTypeRepository(fixture.context); Assert.True(await repository.ExistsAsync(productType.Id)); var sut = await repository.LoadAsync(productType.Id); var productTypeId = sut.Id; Assert.NotNull(sut); Assert.Equal("trousers", sut.Name); await UpdateProductTypeName(sut.Id, "jeans"); await fixture.context.Entry(sut).ReloadAsync(); Assert.Equal("jeans", sut.Name); Assert.Equal(productTypeId, sut.Id); }