//یک دسته با عنوان شعر وادبیات در فهرست دسته بندی ها تعریف میکنم private async void When() { var bookCategory = BookCategoryFactory.GenerateBookCategory("شعروادبیات"); var dto = BookCategoryFactory.GenerateAddBookCategoryDto(bookCategory.Title); _categoryId = await _sut.AddCategory(dto); }
public async void Add_add_category_properly() { var db = new EFInMemoryDatabase(); var context = db.CreateDataContext <EFDataContext>(); var readContext = db.CreateDataContext <EFDataContext>(); var repository = new EFBookCategoryRepository(context); var unitOfWork = new EFUnitOfWork(context); var category = new BookCategory { Title = "dummy-title" }; var dto = new AddBookCategoryDto { Title = category.Title }; var sut = new BookCategoryAppService(unitOfWork, repository); var actual = await sut.AddCategory(dto); var expected = readContext.BookCategories.Single(_ => _.Id == actual); expected.Title.Should().Be(dto.Title); }