public void WhenCheckBoxInvoked_ThenViewModelIsUpdated(string key, string value) { var values = new Dictionary <string, string>() { { key, value } }; var component = new Checkbox(); component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(); ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult; CheckBoxModel resultModel = (CheckBoxModel)result.ViewData.Model; //Assert Assert.AreEqual(value, ViewComponentTestHelper.GetPropertyValue(resultModel, key)); }