Beispiel #1
0
 public static void MonthlyTaskDto(MonthlyTaskDto result, MonthlyTaskDto task)
 {
     AssertSameBasicTaskProperties(result, task);
     AssertSameRecurringTaskProperties(result, task);
     Assert.That(result.RecursOnDayOfMonth, Is.EqualTo(task.RecursOnDayOfMonth));
     Assert.That(result.RecursOnMonth, Is.EqualTo(task.RecursOnMonth));
     Assert.That(result.RecursOnSpecialDayOfMonth, Is.EqualTo(task.RecursOnSpecialDayOfMonth));
 }
Beispiel #2
0
 public static MonthlyTaskDto CreateMonthlyTaskDto()
 {
     var task = new MonthlyTaskDto();
     InitRecurringTaskProperties(task);
     task.RecursOnDayOfMonth = new HashSet<EDayOfMonth> { EDayOfMonth.D1, EDayOfMonth.D15 };
     task.RecursOnMonth = new HashSet<EMonth> { EMonth.March, EMonth.July };
     task.RecursOnSpecialDayOfMonth = new Dictionary<EMonthlyOn, IList<DayOfWeek>> { { EMonthlyOn.First, new List<DayOfWeek> { DayOfWeek.Tuesday } } };
     return task;
 }
        public void SaveTask_AllTypesAndNothignDefinedAndWeeklyFirst_ReturnId1AllTheTime()
        {
            var oneTime = new OneTimeTaskDto();
            var daily = new DailyTaskDto();
            var weekly = new WeeklyTaskDto();
            var monthly = new MonthlyTaskDto();

            var repository = appHost.TryResolve<IRepository>();
            var resultWeekly = repository.CreateTask(weekly);

            var resultDaily = repository.CreateTask(daily);
            var resultOneTime = repository.CreateTask(oneTime);
            var resultMonthly = repository.CreateTask(monthly);

            Assert.That(resultOneTime, Is.EqualTo(1));
            Assert.That(resultDaily, Is.EqualTo(1));
            Assert.That(resultWeekly, Is.EqualTo(1));
            Assert.That(resultMonthly, Is.EqualTo(1));
        }
        public void SaveMonthlyTaskDto_TwoTasks_ReturnId2()
        {
            var task = new MonthlyTaskDto();

            var repository = appHost.TryResolve<IRepository>();
            repository.CreateTask(new MonthlyTaskDto());
            var result = repository.CreateTask(task);

            Assert.That(result, Is.EqualTo(2));
        }
        public void SaveMonthlyTaskDto_NothingDefined_ReturnId1()
        {
            var task = new MonthlyTaskDto();

            var repository = appHost.TryResolve<IRepository>();
            var result = repository.CreateTask(task);

            Assert.That(result, Is.EqualTo(1));
        }
        public void CreateAndUpdateMonthlyTask_Standard_ReturnTwiceTheSameIdAndObject()
        {
            var task = new MonthlyTaskDto { Name = "bla", CallbackUrl = "callback", RecursOnMonth = new HashSet<EMonth> { EMonth.August } };

            var repository = appHost.TryResolve<IRepository>();
            var resultId = repository.CreateTask(task);
            var result = repository.LoadTask<MonthlyTaskDto>(resultId);

            Assert.That(resultId, Is.EqualTo(1));
            AssertSame.MonthlyTaskDto(result, task);

            task = TaskHelper.CreateMonthlyTaskDto();
            task.Id = resultId;
            resultId = repository.UpdateTask(task);
            result = repository.LoadTask<MonthlyTaskDto>(resultId);

            Assert.That(resultId, Is.EqualTo(1));
            AssertSame.MonthlyTaskDto(result, task);
        }