public void ReturnsRightPropertyValue() { var propertyBag = new PropertyBag(); propertyBag.SetPropertyValue("StringProperty", "test"); propertyBag.SetPropertyValue("IntProperty", 1); Assert.AreEqual("test", propertyBag.GetPropertyValue <string>("StringProperty")); Assert.AreEqual(1, propertyBag.GetPropertyValue <int>("IntProperty")); }
public void SetsPropertyCorrectly() { var propertyBag = new PropertyBag(); propertyBag.SetPropertyValue("StringProperty", "A"); Assert.AreEqual("A", propertyBag.GetPropertyValue <string>("StringProperty")); propertyBag.SetPropertyValue("StringProperty", "B"); Assert.AreEqual("B", propertyBag.GetPropertyValue <string>("StringProperty")); }
public void ReturnsAllRegisteredPropertiesWithCorrectValues() { var propertyBag = new PropertyBag(); propertyBag.SetPropertyValue("FirstProperty", 1); propertyBag.SetPropertyValue("SecondProperty", "test"); var allProperties = propertyBag.GetAllProperties().ToList(); Assert.AreEqual(2, allProperties.Count); Assert.AreEqual("FirstProperty", allProperties[0].Key); Assert.AreEqual(1, allProperties[0].Value); Assert.AreEqual("SecondProperty", allProperties[1].Key); Assert.AreEqual("test", allProperties[1].Value); }
public void ReturnsTrueForRegisteredPropertyName() { var propertyBag = new PropertyBag(); propertyBag.SetPropertyValue("MyProperty", 1); Assert.IsTrue(propertyBag.IsPropertyAvailable("MyProperty")); }
public void ReturnsRightPropertyValue() { var propertyBag = new PropertyBag(); propertyBag.SetPropertyValue("StringProperty", "test"); propertyBag.SetPropertyValue("IntProperty", 1); Assert.AreEqual("test", propertyBag.GetPropertyValue<string>("StringProperty")); Assert.AreEqual(1, propertyBag.GetPropertyValue<int>("IntProperty")); }
public void SetsPropertyCorrectly() { var propertyBag = new PropertyBag(); propertyBag.SetPropertyValue("StringProperty", "A"); Assert.AreEqual("A", propertyBag.GetPropertyValue<string>("StringProperty")); propertyBag.SetPropertyValue("StringProperty", "B"); Assert.AreEqual("B", propertyBag.GetPropertyValue<string>("StringProperty")); }
public void ThrowsArgumentExceptionForInvalidPropertyName() { var propertyBag = new PropertyBag(); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => propertyBag.SetPropertyValue(null, null)); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => propertyBag.SetPropertyValue(string.Empty, null)); }
public void ThrowsArgumentExceptionForInvalidPropertyName() { var propertyBag = new PropertyBag(); ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => propertyBag.SetPropertyValue(null, null)); ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => propertyBag.SetPropertyValue(string.Empty, null)); }