public void AddSubCategory_should_add_a_category_to_a_main_category_with_a_parent_category() { var mainCategory = new Fixture().Create <MainCategory>(); var subcategory = new Category("TV Stands", true, Guid.NewGuid().ToString(), 1); mainCategory.AddCategory(subcategory); mainCategory.SubCategories.Should().HaveCount(1).And.Contain(subcategory); }
public void UpdateSubCategory_should_update_a_category_with_a_parent_category() { var mainCategory = new Fixture().Create <MainCategory>(); var subcategory = new Category("TV Stands", true, Guid.NewGuid().ToString(), 1); mainCategory.AddCategory(subcategory); var newParentId = 2; var newTitle = new Fixture().Create <string>(); var newImageId = Guid.NewGuid().ToString(); mainCategory.UpdateCategory(0, newTitle, newImageId, false, newParentId); mainCategory.SubCategories.Should().HaveCount(1); mainCategory.SubCategories.Should().SatisfyRespectively(first => { first.Title.Should().Be(newTitle); first.Image.Name.Should().Be(newImageId); first.IsActive.Should().BeFalse(); first.ParentId.Should().Be(newParentId); }); }