public void SetsPropertyCorrectly() { _propertyBag.SetValue("StringProperty", "A"); Assert.AreEqual("A", _propertyBag.GetValue <string>("StringProperty")); _propertyBag.SetValue("StringProperty", "B"); Assert.AreEqual("B", _propertyBag.GetValue <string>("StringProperty")); }
/// <summary> /// Gets the service object of the specified type. /// </summary> /// <param name="serviceType">An object that specifies the type of service object to get.</param> /// <returns>A service object of type serviceType.-or- null if there is no service object of type serviceType.</returns> public object GetService(Type serviceType) { var report = PropertyBag.GetValue("Report") as IReport; if (serviceType == typeof(IReport)) { return(report); } return(report != null?report.GetService(serviceType) : null); }
object IServiceProvider.GetService(Type serviceType) { var definition = _properties.GetValue("ReportItemDefinition") as IServiceProvider; if (definition != null) { return(definition.GetService(serviceType)); } return(null); }
public void ThrowsArgumentExceptionForInvalidPropertyName() { ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => _propertyBag.GetValue <object>(null)); ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => _propertyBag.GetValue <object>(string.Empty)); }