Update of /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21720/src/Nullables.Tests Added Files: .cvsignore App.config AssemblyInfo.cs BasicTests.cs Nullables.Tests-1.1.csproj Nullables.Tests.build Nullables.Tests.nunit Log Message: NH-15: created a NHibernateContrib folder in cvs --- NEW FILE: .cvsignore --- bin obj .#* *.user *.xsx --- NEW FILE: Nullables.Tests.nunit --- (This appears to be a binary file; contents omitted.) --- NEW FILE: App.config --- <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> </configSections> <nhibernate> <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <add key="hibernate.connection.isolation" value="ReadCommitted" /> <add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" /> <add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" /> <add key="hibernate.connection.connection_string" value="Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI" /> </nhibernate> <!-- This section contains the log4net configuration settings --> <log4net debug="true"> <!-- Define some output appenders --> <appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" > <param name="File" value="log.txt" /> <param name="AppendToFile" value="true" /> <param name="RollingStyle" value="Date" /> <param name="DatePattern" value="yyyy.MM.dd" /> <param name="StaticLogFileName" value="true" /> <layout type="log4net.Layout.PatternLayout,log4net"> <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" /> </layout> </appender> <!-- Setup the root category, add the appenders and set the default priority --> <root> <priority value="ALL" /> <appender-ref ref="rollingFile" /> </root> </log4net> </configuration> --- NEW FILE: BasicTests.cs --- using System; using NUnit.Framework; using Nullables; namespace Nullables.Tests { [TestFixture] public class BasicTests { public BasicTests() { } [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 ); } [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)); } [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)); } [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)); } [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)); } [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)); } [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)); } [Test] public void BasicTestDateTime() { NullableDateTime v1 = new DateTime(1979, 11, 8); //should take an int literal 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)); } [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: Nullables.Tests.build --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Nullables.Tests-1.1.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{2D3FBB15-830A-4A9E-82D7-A0712B7330E1}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "Nullables.Tests" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = 'copy /y "$(ProjectDir)App.config" "$(TargetPath).config"' PostBuildEvent = "" RootNamespace = "Nullables.Tests" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "Nullables" Project = "{9DEFA2EA-4A52-445A-8DA4-6531BD5D76B5}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> <Reference Name = "Nullables.NHibernate" Project = "{35F82297-CAB4-4D57-AAB9-CBDB1F6B8841}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> <Reference Name = "log4net" AssemblyName = "log4net" HintPath = "..\..\lib\net\1.1\log4net.dll" /> <Reference Name = "NHibernate" AssemblyName = "NHibernate" HintPath = "..\..\lib\net\1.1\NHibernate.dll" /> <Reference Name = "nunit.framework" AssemblyName = "nunit.framework" HintPath = "..\..\lib\net\1.1\nunit.framework.dll" /> </References> </Build> <Files> <Include> <File RelPath = "App.config" BuildAction = "None" /> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "BasicTests.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Nullables.Tests.build" BuildAction = "None" /> <File RelPath = "Nullables.Tests.nunit" BuildAction = "None" /> <File RelPath = "NHibernate\NullablesClass.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "NHibernate\NullablesClass.hbm.xml" BuildAction = "EmbeddedResource" /> <File RelPath = "NHibernate\NullablesFixture.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "NHibernate\TestCase.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; //------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ [assembly: AssemblyTitleAttribute("Nullables.Tests for Microsoft .NET Framework 1.1")] [assembly: AssemblyDescriptionAttribute("The Unit Tests for Nullables and their NHibernate Types.")] [assembly: AssemblyCompanyAttribute("nhibernate.sourceforge.net")] [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)] |