Пример #1
0
 public static OneTimeTaskDto CreateOneTimeTaskDto()
 {
     var task = new OneTimeTaskDto();
     InitBasicTaskProperties(task);
     task.Trigger = DateTime.Now.AddDays(10);
     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 SaveOneTimeTaskDto_TwoTasks_ReturnId2()
        {
            var task = new OneTimeTaskDto();

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

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

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

            Assert.That(result, Is.EqualTo(1));
        }
        public void CreateAndUpdateOneTimeTask_Standard_ReturnTwiceTheSameIdAndObject()
        {
            var task = new OneTimeTaskDto { Name = "bla", CallbackUrl = "callback", Trigger = DateTime.Now.AddDays(1) };

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

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

            task = TaskHelper.CreateOneTimeTaskDto();
            task.Id = resultId;
            resultId = repository.UpdateTask(task);
            result = repository.LoadTask<OneTimeTaskDto>(resultId);

            Assert.That(resultId, Is.EqualTo(1));
            AssertSame.OneTimeTaskDto(result, task);
        }
Пример #6
0
 public static void OneTimeTaskDto(OneTimeTaskDto result, OneTimeTaskDto task)
 {
     AssertSameBasicTaskProperties(result, task);
     Assert.That(result.Trigger, IsEqual.WithinOneMillisecond(task.Trigger));
 }