From: Michael D. <mik...@us...> - 2004-12-06 03:17:18
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23391/Nullables.Tests Modified Files: AssemblyInfo.cs Nullables.Tests-1.1.csproj Added Files: NullableBooleanFixture.cs NullableByteFixture.cs NullableDateTimeFixture.cs NullableDecimalFixture.cs NullableDoubleFixture.cs NullableGuidFixture.cs NullableInt16Fixture.cs NullableInt32Fixture.cs NullableInt64Fixture.cs NullableSingleFixture.cs Removed Files: BasicTests.cs Log Message: minor modification to test fixtures. --- NEW FILE: NullableBooleanFixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableBooleanFixture. /// </summary> [TestFixture] public class NullableBooleanFixture { public NullableBooleanFixture() { // // TODO: Add constructor logic here // } } } --- NEW FILE: NullableGuidFixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableGuidFixture. /// </summary> [TestFixture] public class NullableGuidFixture { [Test] public void BasicTestGuid() { NullableGuid v1 = new Guid("00000000-0000-0000-0000-000000000005"); //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(new Guid("00000000-0000-0000-0000-000000000005"))); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == new Guid("00000000-0000-0000-0000-000000000005")); Assert.IsFalse(v1.Equals(NullableGuid.Default)); Assert.IsTrue(v1.Equals(new NullableGuid(new Guid("00000000-0000-0000-0000-000000000005")))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == new Guid("00000000-0000-0000-0000-000000000005")); Assert.IsFalse(v1 == new Guid("00000000-0000-0000-0000-000000000008")); Assert.IsFalse(v1 == NullableGuid.Default); Assert.IsTrue(v1 == new NullableGuid(new Guid("00000000-0000-0000-0000-000000000005"))); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableGuid.Default); v1 = NullableGuid.Default; Assert.IsTrue(v1 == NullableGuid.Default); NullableGuid v2 = NullableGuid.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(new Guid("00000000-0000-0000-0000-000000000002"))); Assert.IsTrue(v2.Equals(NullableGuid.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } --- BasicTests.cs DELETED --- --- NEW FILE: NullableDateTimeFixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableDateTimeFixture. /// </summary> [TestFixture] public class NullableDateTimeFixture { [Test] public void BasicTestDateTime() { NullableDateTime v1 = new DateTime(1979, 11, 8); Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(new DateTime(1979, 11, 8))); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == new DateTime(1979, 11, 8)); Assert.IsFalse(v1.Equals(NullableDateTime.Default)); Assert.IsTrue(v1.Equals(new NullableDateTime(new DateTime(1979, 11, 8)))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == new DateTime(1979, 11, 8)); Assert.IsFalse(v1 == new DateTime(1980, 10, 9)); Assert.IsFalse(v1 == NullableDateTime.Default); Assert.IsTrue(v1 == new NullableDateTime(new DateTime(1979, 11, 8))); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableDateTime.Default); v1 = NullableDateTime.Default; Assert.IsTrue(v1 == NullableDateTime.Default); NullableDateTime v2 = NullableDateTime.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(new DateTime(2004, 12, 25))); Assert.IsTrue(v2.Equals(NullableDateTime.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } --- NEW FILE: NullableInt16Fixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableInt16Fixture. /// </summary> [TestFixture] public class NullableInt16Fixture { [Test] public void BasicTestInt16() { NullableInt16 v1 = 32; //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(32)); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == 32); Assert.IsFalse(v1.Equals(NullableInt16.Default)); Assert.IsTrue(v1.Equals(new NullableInt16(32))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == 32); Assert.IsFalse(v1 == 33); Assert.IsFalse(v1 == NullableInt16.Default); Assert.IsTrue(v1 == new NullableInt16(32)); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableInt16.Default); v1 = NullableInt16.Default; Assert.IsTrue(v1 == NullableInt16.Default); NullableInt16 v2 = NullableInt16.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(12)); Assert.IsTrue(v2.Equals(NullableInt16.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests/AssemblyInfo.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssemblyInfo.cs 12 Nov 2004 22:08:26 -0000 1.1 --- AssemblyInfo.cs 6 Dec 2004 03:16:59 -0000 1.2 *************** *** 17,23 **** [assembly: AssemblyProductAttribute("Nullables.Tests")] [assembly: AssemblyCopyrightAttribute("Licensed under LGPL.")] ! [assembly: AssemblyVersionAttribute("0.4.0.0")] ! [assembly: AssemblyInformationalVersionAttribute("0.4")] ! [assembly: AssemblyFileVersionAttribute("0.4.0.0")] [assembly: AssemblyDelaySignAttribute(false)] --- 17,23 ---- [assembly: AssemblyProductAttribute("Nullables.Tests")] [assembly: AssemblyCopyrightAttribute("Licensed under LGPL.")] ! [assembly: AssemblyVersionAttribute("0.5.0.0")] ! [assembly: AssemblyInformationalVersionAttribute("0.5")] ! [assembly: AssemblyFileVersionAttribute("0.5.0.0")] [assembly: AssemblyDelaySignAttribute(false)] --- NEW FILE: NullableDoubleFixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableDoubleFixture. /// </summary> [TestFixture] public class NullableDoubleFixture { [Test] public void BasicTestDouble() { NullableDouble v1 = 32; //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(32)); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == 32); Assert.IsFalse(v1.Equals(NullableDouble.Default)); Assert.IsTrue(v1.Equals(new NullableDouble(32))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == 32); Assert.IsFalse(v1 == 33); Assert.IsFalse(v1 == NullableDouble.Default); Assert.IsTrue(v1 == new NullableDouble(32)); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableDouble.Default); v1 = NullableDouble.Default; Assert.IsTrue(v1 == NullableDouble.Default); NullableDouble v2 = NullableDouble.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(12)); Assert.IsTrue(v2.Equals(NullableDouble.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } --- NEW FILE: NullableInt64Fixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableInt64Fixture. /// </summary> [TestFixture] public class NullableInt64Fixture { [Test] public void BasicTestInt64() { NullableInt64 v1 = 46816684; //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(46816684)); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == 46816684); Assert.IsFalse(v1.Equals(NullableInt64.Default)); Assert.IsTrue(v1.Equals(new NullableInt64(46816684))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == 46816684); Assert.IsFalse(v1 == 448494894); Assert.IsFalse(v1 == NullableInt64.Default); Assert.IsTrue(v1 == new NullableInt64(46816684)); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableInt64.Default); v1 = NullableInt64.Default; Assert.IsTrue(v1 == NullableInt64.Default); NullableInt64 v2 = NullableInt64.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(4484)); Assert.IsTrue(v2.Equals(NullableInt64.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } --- NEW FILE: NullableDecimalFixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableDecimalFixture. /// </summary> [TestFixture] public class NullableDecimalFixture { [Test] public void BasicTestDecimal() { NullableDecimal v1 = 4.99m; //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(4.99m)); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == 4.99m); Assert.IsFalse(v1.Equals(NullableDecimal.Default)); Assert.IsTrue(v1.Equals(new NullableDecimal(4.99m))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == 4.99m); Assert.IsFalse(v1 == 5.01m); Assert.IsFalse(v1 == NullableDecimal.Default); Assert.IsTrue(v1 == new NullableDecimal(4.99m)); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableDecimal.Default); v1 = NullableDecimal.Default; Assert.IsTrue(v1 == NullableDecimal.Default); NullableDecimal v2 = NullableDecimal.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(4.01m)); Assert.IsTrue(v2.Equals(NullableDecimal.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } --- NEW FILE: NullableSingleFixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableSingleFixture. /// </summary> [TestFixture] public class NullableSingleFixture { [Test] public void BasicTestSingle() { NullableSingle v1 = 32; //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(32)); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == 32); Assert.IsFalse(v1.Equals(NullableSingle.Default)); Assert.IsTrue(v1.Equals(new NullableSingle(32))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == 32); Assert.IsFalse(v1 == 33); Assert.IsFalse(v1 == NullableSingle.Default); Assert.IsTrue(v1 == new NullableSingle(32)); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableSingle.Default); v1 = NullableSingle.Default; Assert.IsTrue(v1 == NullableSingle.Default); NullableSingle v2 = NullableSingle.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(12)); Assert.IsTrue(v2.Equals(NullableSingle.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } Index: Nullables.Tests-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests/Nullables.Tests-1.1.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Nullables.Tests-1.1.csproj 12 Nov 2004 22:08:26 -0000 1.1 --- Nullables.Tests-1.1.csproj 6 Dec 2004 03:17:00 -0000 1.2 *************** *** 119,123 **** /> <File ! RelPath = "BasicTests.cs" SubType = "Code" BuildAction = "Compile" --- 119,163 ---- /> <File ! RelPath = "NullableBooleanFixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableByteFixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableDateTimeFixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableDecimalFixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableDoubleFixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableGuidFixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableInt16Fixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableInt32Fixture.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "NullableInt64Fixture.cs" SubType = "Code" BuildAction = "Compile" *************** *** 132,135 **** --- 172,180 ---- /> <File + RelPath = "NullableSingleFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NHibernate\NullablesClass.cs" SubType = "Code" --- NEW FILE: NullableByteFixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableByteFixture. /// </summary> [TestFixture] public class NullableByteFixture { [Test] public void BasicTestByte() { NullableByte v1 = 32; //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(32)); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == 32); Assert.IsFalse(v1.Equals(NullableByte.Default)); Assert.IsTrue(v1.Equals(new NullableByte(32))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == 32); Assert.IsFalse(v1 == 33); Assert.IsFalse(v1 == NullableByte.Default); Assert.IsTrue(v1 == new NullableByte(32)); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableByte.Default); v1 = NullableByte.Default; Assert.IsTrue(v1 == NullableByte.Default); NullableByte v2 = NullableByte.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(12)); Assert.IsTrue(v2.Equals(NullableByte.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); } } } --- NEW FILE: NullableInt32Fixture.cs --- using System; using Nullables; using NUnit.Framework; namespace Nullables.Tests { /// <summary> /// Summary description for NullableInt32Fixture. /// </summary> [TestFixture] public class NullableInt32Fixture { [Test] public void BasicTestInt32() { NullableInt32 v1 = 32; //should take an int literal Assert.IsTrue(v1.HasValue); //should have a value; Assert.IsTrue(v1.Equals(32)); //implicit casting should make this result in true. Assert.IsTrue(v1.Value == 32); Assert.IsFalse(v1.Equals(NullableInt32.Default)); Assert.IsTrue(v1.Equals(new NullableInt32(32))); //should == a new instance with the same inner value. //same thing, but with == instead of .Equals() Assert.IsTrue(v1 == 32); Assert.IsFalse(v1 == 33); Assert.IsFalse(v1 == NullableInt32.Default); Assert.IsTrue(v1 == new NullableInt32(32)); //now null v1. v1 = DBNull.Value; Assert.IsTrue(v1 == NullableInt32.Default); v1 = NullableInt32.Default; Assert.IsTrue(v1 == NullableInt32.Default); NullableInt32 v2 = NullableInt32.Default; //should start as "null" Assert.IsFalse(v2.HasValue); Assert.IsFalse(v2.Equals(12)); Assert.IsTrue(v2.Equals(NullableInt32.Default)); Assert.IsTrue(v2.Equals(DBNull.Value)); Assert.IsTrue( v2==null ); } } } |