ResultClassTest.cs :  » Persistence-Frameworks » iBATIS.NET » IBatisNet » DataMapper » Test » NUnit » SqlMapTests » Generics » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Persistence Frameworks » iBATIS.NET 
iBATIS.NET » IBatisNet » DataMapper » Test » NUnit » SqlMapTests » Generics » ResultClassTest.cs
#if dotnet2
using System;

using NUnit.Framework;

using IBatisNet.DataMapper.Test.Domain;

namespace IBatisNet.DataMapper.Test.NUnit.SqlMapTests.Generics{
  /// <summary>
  /// Summary description for ResultClassTest.
  /// </summary>
  [TestFixture] 
  public class ResultClassTest : BaseTest
  {
    #region SetUp & TearDown

    /// <summary>
    /// SetUp
    /// </summary>
    [SetUp] 
    public void Init() 
    {
    }

    /// <summary>
    /// TearDown
    /// </summary>
    [TearDown] 
    public void Dispose()
    { /* ... */ } 

    #endregion

    #region Specific statement test

    /// <summary>
    ///  Test a boolean resultClass
    /// </summary>
    [Test]
    public void TestBoolean() 
    {
      bool bit = sqlMap.QueryForObject<bool>("GetBoolean", 1);

      Assert.AreEqual(true, bit);
    }

    /// <summary>
    ///  Test a byte resultClass
    /// </summary>
    [Test] 
    public void TestByte() 
    {
      byte letter = sqlMap.QueryForObject<byte>("GetByte", 1);

      Assert.AreEqual(155, letter);
    }

    /// <summary>
    ///  Test a char resultClass
    /// </summary>
    [Test] 
    public void TestChar() 
    {
      char letter = sqlMap.QueryForObject<char>("GetChar", 1);

      Assert.AreEqual('a', letter);
    }
            
    /// <summary>
    ///  Test a DateTime resultClass
    /// </summary>
    [Test] 
    public void TestDateTime() 
    {
      DateTime orderDate = sqlMap.QueryForObject<DateTime>("GetDate", 1);

      System.DateTime date = new DateTime(2003, 2, 15, 8, 15, 00);

      Assert.AreEqual(date.ToString(), orderDate.ToString());
    }

    /// <summary>
    ///  Test a decimal resultClass
    /// </summary>
    [Test] 
    public void TestDecimal() 
    {
      decimal price = sqlMap.QueryForObject<decimal>("GetDecimal", 1);

      Assert.AreEqual((decimal)1.56, price);
    }

    /// <summary>
    ///  Test a double resultClass
    /// </summary>
    [Test] 
    public void TestDouble() 
    {
      double price = sqlMap.QueryForObject<double>("GetDouble", 1);

      Assert.AreEqual(99.5f, price);
    }

    /// <summary>
    ///  IBATISNET-25 Error applying ResultMap when using 'Guid' in resultClass
    /// </summary>
    [Test] 
    public void TestGuid() 
    {
      Guid newGuid = new Guid("CD5ABF17-4BBC-4C86-92F1-257735414CF4");

      Guid guid = sqlMap.QueryForObject<Guid>("GetGuid", 1);

      Assert.AreEqual(newGuid, guid);
    }

    /// <summary>
    ///  Test a int16 resultClass
    /// </summary>
    [Test] 
    public void TestInt16() 
    {
      short integer = sqlMap.QueryForObject<short>("GetInt16", 1);

      Assert.AreEqual(32111, integer);
    }

    /// <summary>
    ///  Test a int 32 resultClass
    /// </summary>
    [Test] 

    public void TestInt32() 
    {
      int integer = sqlMap.QueryForObject<int>("GetInt32", 1);

      Assert.AreEqual(999999, integer);
    }

    /// <summary>
    ///  Test a int64 resultClass
    /// </summary>
    [Test] 
    public void TestInt64() 
    {
      long bigInt = sqlMap.QueryForObject<long>("GetInt64", 1);

      Assert.AreEqual(9223372036854775800, bigInt);
    }

    /// <summary>
    ///  Test a single/float resultClass
    /// </summary>
    [Test] 
    public void TestSingle() 
    {
      float price = sqlMap.QueryForObject<float>("GetSingle", 1);

      Assert.AreEqual(92233.5, price);
    }

    /// <summary>
    ///  Test a string resultClass
    /// </summary>
    [Test] 
    public void TestString() 
    {
      string cardType = sqlMap.QueryForObject<string>("GetString", 1);

      Assert.AreEqual("VISA", cardType);
    }

    
    #endregion
  }
}
#endif
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.