예제 #1
0
 public static void WeeklyTaskDto(WeeklyTaskDto result, WeeklyTaskDto task)
 {
     AssertSameBasicTaskProperties(result, task);
     AssertSameRecurringTaskProperties(result, task);
     Assert.That(result.TriggerWhenDayOfWeek, Is.EqualTo(task.TriggerWhenDayOfWeek));
     Assert.That(result.RecursEveryXWeeks, Is.EqualTo(task.RecursEveryXWeeks));
 }
예제 #2
0
 public static WeeklyTaskDto CreateWeaklyTaskDto()
 {
     var task = new WeeklyTaskDto();
     InitRecurringTaskProperties(task);
     task.TriggerWhenDayOfWeek = new HashSet<DayOfWeek> { DayOfWeek.Monday, DayOfWeek.Friday };
     task.RecursEveryXWeeks = 2;
     return task;
 }
        public void SaveWeeklyTaskDto_TwoTasks_ReturnId2()
        {
            var task = new WeeklyTaskDto();

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

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

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

            Assert.That(result, Is.EqualTo(1));
        }
        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 CreateAndUpdateWeeklyTask_Standard_ReturnTwiceTheSameIdAndObject()
        {
            var task = new WeeklyTaskDto { Name = "bla", CallbackUrl = "callback", RecursEveryXWeeks = 98 };

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

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

            task = TaskHelper.CreateWeaklyTaskDto();
            task.Id = resultId;
            resultId = repository.UpdateTask(task);
            result = repository.LoadTask<WeeklyTaskDto>(resultId);

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