diff --git a/SportsStore/SportsStore.UnitTests/UnitTest1.cs b/SportsStore/SportsStore.UnitTests/UnitTest1.cs index 243d7e7..cc35209 100644 --- a/SportsStore/SportsStore.UnitTests/UnitTest1.cs +++ b/SportsStore/SportsStore.UnitTests/UnitTest1.cs @@ -149,5 +149,30 @@ namespace SportsStore.UnitTests Assert.AreEqual(results[1], "Oranges"); Assert.AreEqual(results[2], "Plums"); } + + [TestMethod] + public void Indicates_Selected_Category() + { + // Arrange + // - create the mock repository + Mock mock = new Mock(); + mock.Setup(m => m.Products).Returns(new Product[] + { + new Product { ProductID = 1, Name = "P1", Category = "Apples" }, + new Product { ProductID = 4, Name = "P2", Category = "Oranges" }, + }); + + // Arrange - create the controller + NavController target = new NavController(mock.Object); + + // Arrange - define the category to selected + string categoryToSelected = "Apples"; + + // Action + string result = target.Menu(categoryToSelected).ViewBag.SelectedCategory; + + // Assert + Assert.AreEqual(categoryToSelected, result); + } } }