public static Week WeekNew() { var week = WeekRepository.WeekNew(); week.StartDate = DateTime.Now.AddDays(DataHelper.RandomNumber(1000)); week.EndDate = week.StartDate.AddDays(7); week.Year = week.StartDate.Year; week.Period = 1; return(week); }
public void Week_Create() { var week = WeekRepository.WeekNew(); Assert.IsTrue(week.IsNew, "IsNew should be true"); Assert.IsTrue(week.IsDirty, "IsDirty should be true"); Assert.IsFalse(week.IsValid, "IsValid should be false"); Assert.IsTrue(week.IsSelfDirty, "IsSelfDirty should be true"); Assert.IsFalse(week.IsSelfValid, "IsSelfValid should be false"); Assert.IsTrue( ValidationHelper.ContainsRule(week, DbType.Date, "StartDate"), "StartDate should be required"); Assert.IsTrue( ValidationHelper.ContainsRule(week, DbType.Date, "EndDate"), "EndDate should be required"); }