⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smartdatetests.vb

📁 C# 版本的一个三层商业架构
💻 VB
字号:
<TestFixture()> _
Public Class SmartDateTests

  <Test()> _
  Public Sub Add()
    Dim d2 As New SmartDate
    Dim d3 As SmartDate

    d2.Date = #1/1/2005#
    d3 = SmartDate.op_Addition(d2, New TimeSpan(30, 0, 0, 0))
    Assert.AreEqual(DateAdd(DateInterval.Day, 30, d2.Date), d3.Date, "Dates should be equal")

  End Sub

  <Test()> _
  Public Sub Subtract()
    Dim d2 As New SmartDate
    Dim d3 As SmartDate

    d2.Date = #1/1/2005#
    d3 = SmartDate.op_Subtraction(d2, New TimeSpan(30, 0, 0, 0))
    Assert.AreEqual(DateAdd(DateInterval.Day, -30, d2.Date), d3.Date, "Dates should be equal")

  End Sub

  <Test()> _
  Public Sub Comparison()
    Dim d2 As New SmartDate(True)
    Dim d3 As New SmartDate(False)

    Assert.IsTrue(d2.Equals(d3), "Empty dates should be equal")
    Assert.IsTrue(SmartDate.op_Equality(d2, d3), "Empty dates should be equal")

    d2.Date = #1/1/2005#
    d3 = New SmartDate(d2.Date, d2.EmptyIsMin)
    Assert.AreEqual(d2, d3, "Assigned dates should be equal")

    d3.Date = #2/2/2005#
    Assert.IsTrue(SmartDate.op_GreaterThan(d3, d2), "Should be greater than")
    Assert.IsTrue(SmartDate.op_LessThan(d2, d3), "Should be less than")
    Assert.IsTrue(SmartDate.op_Inequality(d2, d3), "Should not be equal")

  End Sub

  <Test()> _
  Public Sub Empty()
    Dim d2 As New SmartDate
    Dim d3 As SmartDate

    d3 = SmartDate.op_Addition(d2, New TimeSpan(30, 0, 0, 0))
    Assert.AreEqual(d2, d3, "Dates should be equal")

    d3 = SmartDate.op_Subtraction(d2, New TimeSpan(30, 0, 0, 0))
    Assert.AreEqual(d2, d3, "Dates should be equal")

  End Sub

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -