public async Task CreateAsyncShouldReturnCorrectId()
        {
            const string name = nameof(name);

            ApplicationDbContext dbContext = this.GetNewDbContext();

            IRepository <ProductType> repository = new EfRepository <ProductType>(dbContext);

            IProductTypeService service = new ProductTypeService(repository);

            string id = await service.CreateAsync(name);

            ProductType productType = dbContext.ProductTypes
                                      .Where(pt => pt.Id == id)
                                      .FirstOrDefault();

            Assert.NotNull(productType);
            Assert.Equal(name, productType.Name);
        }
        public async Task CreateAsyncShouldThrowIfNameIsTaken()
        {
            const string name = nameof(name);

            ApplicationDbContext dbContext = this.GetNewDbContext();

            dbContext.ProductTypes.Add(new ProductType
            {
                Name = name,
            });

            await dbContext.SaveChangesAsync();

            IRepository <ProductType> repository = new EfRepository <ProductType>(dbContext);

            IProductTypeService service = new ProductTypeService(repository);

            await Assert.ThrowsAsync <ServiceException>(async() =>
            {
                await service.CreateAsync(name);
            });
        }