mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
781 B
25 lines
781 B
using System;
|
|
using Shouldly;
|
|
using Xunit;
|
|
|
|
namespace Volo.ExtensionMethods.Tests
|
|
{
|
|
public class ComparableExtensions_Tests
|
|
{
|
|
[Fact]
|
|
public void IsBetween_Test()
|
|
{
|
|
//Number
|
|
var number = 5;
|
|
number.IsBetween(1, 10).ShouldBe(true);
|
|
number.IsBetween(1, 5).ShouldBe(true);
|
|
number.IsBetween(5, 10).ShouldBe(true);
|
|
number.IsBetween(10, 20).ShouldBe(false);
|
|
|
|
//DateTime
|
|
var dateTimeValue = new DateTime(2014, 10, 4, 18, 20, 42, 0);
|
|
dateTimeValue.IsBetween(new DateTime(2014, 1, 1), new DateTime(2015, 1, 1)).ShouldBe(true);
|
|
dateTimeValue.IsBetween(new DateTime(2015, 1, 1), new DateTime(2016, 1, 1)).ShouldBe(false);
|
|
}
|
|
}
|
|
} |