public void Get_the_fields_from_an_object() { var result = new MyClass().GetFieldList(); Assert.That(result.Count == 2); Assert.That(result.ContainsKey("_fieldOne")); }
public void Sets_the_value_for_a_field() { var m = new MyClass(); m.SetField("_fieldOne", "Value one"); Assert.AreEqual(m._fieldOne, "Value one"); }
public void Get_the_properties_from_an_object() { var result = new MyClass().GetPropertyList(); Assert.That(result.Count == 2); Assert.That(result.ContainsKey("PropertyOne")); }
public void Get_the_fields_and_properties_from_an_object() { var result = new MyClass().GetFieldAndPropertyList(); Assert.That(result.Count == 4); Assert.That(result.ContainsKey("_fieldOne")); Assert.That(result.ContainsKey("PropertyOne")); }
public void Adding_an_object_to_the_cache_by_key() { ICache caching = new DbCache(mockLogger); var mc = new MyClass(); bool added = caching.Add("firstItem", mc); Assert.IsTrue(added); }
public void Adding_an_object_with_an_sliding_expiration_date() { ICache caching = new DbCache(mockLogger); var mc = new MyClass(); bool added = caching.AddAndKeepWhileUsed("thirdItem", mc, new TimeSpan(0, 2, 0)); Assert.IsTrue(added); }
public void Adding_an_object_with_an_absolute_expiration_date() { ICache caching = new DbCache(mockLogger); var mc = new MyClass(); bool added = caching.AddAndKeepFor("secondItem", mc, new TimeSpan(0, 2, 0)); Assert.IsTrue(added); }
public void Sets_Properties_from_a_NameValueCollection() { var collection = new NameValueCollection { {"propertyone", VALUE_SET_FOR_PROPERTY_ONE}, {"propertythree", "this does not exist"}, {"PropertyTwo", "Trying to change a read only property"} }; var mc = new MyClass().Hydrate(collection); Assert.That(mc.PropertyOne, Is.EqualTo(VALUE_SET_FOR_PROPERTY_ONE)); Assert.That(mc.PropertyTwo, Is.EqualTo("Value of property two")); }
private MyClass CreateModel() { var c = new MyClass { MyId = 123, MyString = "John", MyGuid = Guid.NewGuid(), MyDateTime = DateTime.Now, MyProperty = "SerializeTHIS", MyIgnore = "IgnoreTHIS", MyIntNullable = 999, MyStringList = new List<string>() { "String-1", "String-2" }, MyWriteOnly = "write-only", MyInternalProperty = "internal-field", MyNameValueCollection = new NameValueCollection(), MyDict = new Dictionary<int, string>() { { 1, "Row1" }, { 2, "Row2" } }, MyStringArray = new string[] { "One", "Two" }, MyEnumProp = MyEnum.Second, MyChar = 'Y', MyUri = new Uri("http://www.numeria.com.br"), MyByte = 255, MyDecimal = 19.9m, MyDecimalNullable = 25.5m, MyInterface = new MyImpl { Name = "John" }, MyListInterface = new List<IMyInterface>() { new MyImpl { Name = "John" } }, MyIListInterface = new List<IMyInterface>() { new MyImpl { Name = "John" } }, MyObjectString = "MyString", MyObjectInt = 123, MyObjectImpl = new MyImpl { Name = "John" }, MyObjectList = new List<object>() { 1, "ola", new MyImpl { Name = "John" }, new Uri("http://www.cnn.com") } }; c.MyNameValueCollection["key-1"] = "value-1"; c.MyNameValueCollection["KeyNumber2"] = "value-2"; return c; }
public void Sets_the_value_for_a_property() { var m = new MyClass(); m.SetProperty("PropertyOne", "Value one"); Assert.AreEqual(m.PropertyOne , "Value one"); }
public void Gets_the_value_for_a_property() { var result = new MyClass().GetPropertyValue<string>("PropertyOne"); Assert.AreEqual("Value of property one", result); }
public void Gets_the_value_for_a_field() { var result = new MyClass().GetFieldValue<string>("_fieldOne"); Assert.AreEqual("value of field 1", result); }
public void TestCase () { MyClass c = new MyClass (); Assert.AreEqual(c.TestMethod(10,10), 20); }
public void Gets_the_value_for_a_field() { var result = new MyClass().GetFieldValue <string>("_fieldOne"); Assert.AreEqual("value of field 1", result); }
public void Gets_the_value_for_a_property() { var result = new MyClass().GetPropertyValue <string>("PropertyOne"); Assert.AreEqual("Value of property one", result); }