Beispiel #1
0
            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"));
            }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
        object IServiceProvider.GetService(Type serviceType)
        {
            var definition = _properties.GetValue("ReportItemDefinition") as IServiceProvider;

            if (definition != null)
            {
                return(definition.GetService(serviceType));
            }

            return(null);
        }
Beispiel #4
0
 public void ThrowsArgumentExceptionForInvalidPropertyName()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => _propertyBag.GetValue <object>(null));
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => _propertyBag.GetValue <object>(string.Empty));
 }