|
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Catel.Test.Data
{
[TestClass]
public class PropertyDataTest
{
[TestMethod]
public void DefaultPropertyValueTest()
{
// Create class
var propertiesObject = new ObjectWithoutDefaultValues();
// Check value types
Assert.AreEqual(1, propertiesObject.ValueType);
Assert.AreEqual(0, propertiesObject.ValueTypeWithoutDefaultValue);
// Check reference types
Assert.AreNotEqual(null, propertiesObject.ReferenceType);
Assert.AreEqual(null, propertiesObject.ReferenceTypeWithoutDefaultValue);
}
[TestMethod]
public void GenericGetDefaultValueForNullableType()
{
var property = ObjectWithoutDefaultValues.ReferenceTypeProperty;
Assert.AreEqual(property.GetDefaultValue(), property.GetDefaultValue<object>());
}
[TestMethod]
public void GenericGetDefaultValueForValueType()
{
var property = ObjectWithoutDefaultValues.ValueTypeProperty;
Assert.AreEqual(property.GetDefaultValue(), property.GetDefaultValue<int>());
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.