public void TestValue() { ConfigurationItem configurationItem = new ConfigurationItem(123, "<description>"); Assert.That(configurationItem.DefaultValue, Is.EqualTo(123)); Assert.That(configurationItem.UserValue, Is.EqualTo(null)); Assert.That(configurationItem.Value, Is.EqualTo(123)); configurationItem.SetUserValue("456"); Assert.That(configurationItem.DefaultValue, Is.EqualTo(123)); Assert.That(configurationItem.UserValue, Is.EqualTo(456)); Assert.That(configurationItem.Value, Is.EqualTo(456)); configurationItem.ResetDefault(); Assert.That(configurationItem.DefaultValue, Is.EqualTo(123)); Assert.That(configurationItem.UserValue, Is.EqualTo(null)); Assert.That(configurationItem.Value, Is.EqualTo(123)); }
public void TestHasUserValueSpecified() { ConfigurationItem configurationItem = new ConfigurationItem((byte)123, "<description>"); Assert.That(configurationItem.HasUserValueSpecified == false); configurationItem.SetUserValue("123"); Assert.That(configurationItem.HasUserValueSpecified == false); configurationItem.SetUserValue("124"); Assert.That(configurationItem.HasUserValueSpecified == true); configurationItem.ResetDefault(); Assert.That(configurationItem.HasUserValueSpecified == false); configurationItem = new ConfigurationItem((int)123, "<description>"); configurationItem.SetUserValue("123"); Assert.That(configurationItem.HasUserValueSpecified == false); configurationItem.SetUserValue("124"); Assert.That(configurationItem.HasUserValueSpecified == true); configurationItem = new ConfigurationItem((uint)123, "<description>"); configurationItem.SetUserValue("123"); Assert.That(configurationItem.HasUserValueSpecified == false); configurationItem.SetUserValue("124"); Assert.That(configurationItem.HasUserValueSpecified == true); configurationItem = new ConfigurationItem((double)123.0, "<description>"); configurationItem.SetUserValue("123.0"); Assert.That(configurationItem.HasUserValueSpecified == false); configurationItem.SetUserValue("124.0"); Assert.That(configurationItem.HasUserValueSpecified == true); configurationItem = new ConfigurationItem((bool)true, "<description>"); configurationItem.SetUserValue("true"); Assert.That(configurationItem.HasUserValueSpecified == false); configurationItem.SetUserValue("false"); Assert.That(configurationItem.HasUserValueSpecified == true); }