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.
abp/test/Volo.Abp.Tests/System/DayOfWeekExtensions_Tests.cs

27 lines
816 B

using Shouldly;
using Xunit;
namespace System
{
public class DayOfWeekExtensions_Tests
{
[Fact]
public void Weekend_Weekday_Test()
{
DayOfWeek.Monday.IsWeekday().ShouldBe(true);
DayOfWeek.Monday.IsWeekend().ShouldBe(false);
DayOfWeek.Saturday.IsWeekend().ShouldBe(true);
DayOfWeek.Saturday.IsWeekday().ShouldBe(false);
var datetime1 = new DateTime(2014, 10, 5, 16, 37, 25); //Sunday
var datetime2 = new DateTime(2014, 10, 7, 16, 37, 25); //Tuesday
datetime1.DayOfWeek.IsWeekend().ShouldBe(true);
datetime2.DayOfWeek.IsWeekend().ShouldBe(false);
datetime1.DayOfWeek.IsWeekday().ShouldBe(false);
datetime2.DayOfWeek.IsWeekday().ShouldBe(true);
}
}
}