static void AssertPropertyIsOfType <TContainer, TValue>(IPropertyBag <TContainer> propertyBag, string propertyName) { var container = TypeConstruction.Construct <TContainer>(typeof(TContainer)); var changeTracker = default(ChangeTracker); var action = new AssertThatPropertyIsOfType <TContainer, TValue>(); Assert.That(propertyBag.FindProperty(propertyName, ref container, ref changeTracker, ref action), Is.True); }
/// <summary> /// Checks if the given <see cref="IPropertyBag{TContainer}"/> has any property with the given name. /// </summary> public static bool HasProperty <TContainer>(this IPropertyBag <TContainer> propertyBag, string name) { var instance = default(TContainer); var changeTracker = default(ChangeTracker); var action = default(FoundAction <TContainer>); propertyBag.FindProperty(name, ref instance, ref changeTracker, ref action); return(action.Found); }
static void AssertPropertyValueAndTypeIsEqualTo <TContainer>(IPropertyBag <TContainer> propertyBag, string propertyName, object expectedValue) { var container = TypeConstruction.Construct <TContainer>(typeof(TContainer)); var changeTracker = default(ChangeTracker); var action = new AssertThatPropertyValueAndTypeIsEqualTo <TContainer> { ExpectedValue = expectedValue }; Assert.That(propertyBag.FindProperty(propertyName, ref container, ref changeTracker, ref action), Is.True); }