/// <summary> /// Test the ValueAsObject method for structure types. /// </summary> /// <typeparam name="T">The structure type.</typeparam> /// <param name="columnValue">The column value.</param> /// <param name="value">The value to set.</param> /// <param name="expectedLength">The expected value length.</param> private static void TestLengthForStruct <T>(ColumnValueOfStruct <T> columnValue, T value, int expectedLength) where T : struct, IEquatable <T> { columnValue.Value = value; Assert.AreEqual(expectedLength, columnValue.Length); columnValue.Value = null; Assert.AreEqual(0, columnValue.Length); }
/// <summary> /// Test the ValueAsObject method for structure types. /// </summary> /// <typeparam name="T">The structure type.</typeparam> /// <param name="columnValue">The column value.</param> /// <param name="value">The value to set.</param> private static void TestValueAsObjectForStruct <T>(ColumnValueOfStruct <T> columnValue, T value) where T : struct, IEquatable <T> { columnValue.Value = value; object o1 = columnValue.ValueAsObject; Assert.AreEqual(o1, value); columnValue.Value = null; Assert.IsNull(columnValue.ValueAsObject); columnValue.Value = value; object o2 = columnValue.ValueAsObject; Assert.AreEqual(o1, o2); Assert.AreSame(o1, o2); columnValue.Value = default(T); Assert.AreEqual(columnValue.ValueAsObject, default(T)); }