Exemplo n.º 1
0
        public async Task ContainsByIdAsync_WithValidId_ShouldReturnTrue()
        {
            var subCategoryName = "test";

            var subCategory = new SubCategory()
            {
                Name       = subCategoryName,
                CategoryId = "test",
            };

            await context.SubCategories.AddAsync(subCategory);

            await context.SaveChangesAsync();

            var subCategoryFromDb = await context.SubCategories.FirstOrDefaultAsync(s => s.Name == subCategoryName);

            var result = await service.ContainsByIdAsync(subCategoryFromDb.Id.ToString());

            Assert.IsTrue(result);
        }