public void First_Name_Variations_All_Match() { var nameSelector = new FirstNameSelector(); var firstNameTestClass = new FirstNameTestClass(); //Iterate over all of the properties in the fullNameClass object... foreach (var property in firstNameTestClass.GetType().GetProperties()) { var nameSelectorResult = nameSelector.CanBind(property); Assert.IsTrue(nameSelectorResult, string.Format("{0} should have been a valid match", property.Name)); } }
public void First_Name_Variations_All_Injected() { var nameSelector = new FirstNameSelector(); var firstNameTestClass = new FirstNameTestClass(); //Iterate over all of the properties in the fullNameClass object... foreach (var property in firstNameTestClass.GetType().GetProperties()) { //Inject the value into the property nameSelector.Generate(firstNameTestClass, property); } //Iterate over all of the properties again foreach (var property in firstNameTestClass.GetType().GetProperties()) { var fieldValue = property.GetValue(firstNameTestClass, null) as string; Assert.IsNotNullOrEmpty(fieldValue); Assert.IsAssignableFrom<string>(fieldValue, "Should be type of string..."); Assert.That(fieldValue.Length > 0); } }
public void First_Name_Variations_All_Injected() { var nameSelector = new FirstNameSelector(); var firstNameTestClass = new FirstNameTestClass(); //Iterate over all of the properties in the fullNameClass object... foreach (var property in firstNameTestClass.GetType().GetProperties()) { //Inject the value into the property nameSelector.Generate(firstNameTestClass, property); } //Iterate over all of the properties again foreach (var property in firstNameTestClass.GetType().GetProperties()) { var fieldValue = property.GetValue(firstNameTestClass, null) as string; Assert.IsNotNullOrEmpty(fieldValue); Assert.IsAssignableFrom <string>(fieldValue, "Should be type of string..."); Assert.That(fieldValue.Length > 0); } }