|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Yap.Data.Client;
namespace Yap.Data.UnitTest
{
[TestClass]
public class FieldTestFixture
{
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Constructor_NameIsEmpty_ThrowArgumentNullException()
{
new Field(String.Empty, typeof(Int32));
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Constructor_TypeIsNull_ThrowArgumentNullException()
{
new Field("an field", null);
}
[TestMethod]
public void Equals_OtherIsNull_ReturnFalse()
{
var field = new Field("an field", typeof(Int32));
Assert.IsFalse(field.Equals(null), "Equals() with null should return false.");
}
[TestMethod]
public void Equals_FullTest()
{
var one = new Field("an field", typeof(Int32));
var another = new Field("an field", typeof(Int32));
Assert.AreEqual(one, another, "Equals() with equal field should return true.");
one = new Field("another field", typeof(Int32));
Assert.AreNotEqual(one, another, "Equals() with not equal field should return false.");
}
[TestMethod]
public void ToString__ShouldBeEqualToName()
{
var field = new Field("an field", typeof(Int32));
Assert.AreEqual(field.Name, field.ToString(), "ToString() should be equal to Field.Name.");
}
[TestMethod]
public void GetHashCode__ShouldBeEqualToNameGetHashCode()
{
var field = new Field("an field", typeof(Int32));
Assert.AreEqual(field.Name.GetHashCode(), field.GetHashCode(), "GetHashCode() should be equal to Field.Name.GetHashCode().");
}
}
}
|
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.