public void Seed_ValidOptions_Ok() { CategoriesPartSeeder seeder = new CategoriesPartSeeder(); seeder.SetSeedOptions(_seedOptions); seeder.Configure(new CategoriesPartSeederOptions { MaxCategoriesPerItem = 3, Categories = new[] { "alpha", "beta", "gamma" } }); IPart part = seeder.GetPart(_item, null, _factory); Assert.NotNull(part); CategoriesPart cp = part as CategoriesPart; Assert.NotNull(cp); TestHelper.AssertPartMetadata(cp); Assert.NotEmpty(cp.Categories); }
public void Seed_NoCategories_Null() { CategoriesPartSeeder seeder = new CategoriesPartSeeder(); seeder.SetSeedOptions(_seedOptions); seeder.Configure(new CategoriesPartSeederOptions { MaxCategoriesPerItem = 3, Categories = Array.Empty <string>() // invalid }); Assert.Null(seeder.GetPart(_item, null, _factory)); }
public void Seed_InvalidMax_Null() { CategoriesPartSeeder seeder = new CategoriesPartSeeder(); seeder.SetSeedOptions(_seedOptions); seeder.Configure(new CategoriesPartSeederOptions { MaxCategoriesPerItem = 0, // invalid Categories = new[] { "alpha", "beta", "gamma" } }); Assert.Null(seeder.GetPart(_item, null, _factory)); }