Пример #1
0
        public async Task CheckNoRecords()
        {
            var table = Substitute.For<ITableStorage>();
            table.QueryByPartition<ScheduledTaskEntry>(Arg.Any<string>()).Returns(Task.FromResult<IEnumerable<ScheduledTaskEntry>>(new List<ScheduledTaskEntry>()));

            var core = new Coordinator(table, new TimeSpan(9000));
            var perform = await core.Check(this.GetType());

            Assert.IsTrue(perform);

            table.Received().QueryByPartition<ScheduledTaskEntry>(Arg.Any<string>());
        }
Пример #2
0
        public async Task CheckCompletedFailureOld()
        {
            var records = new List<ScheduledTaskEntry>();
            var record = new ScheduledTaskEntry()
            {
                StartTime = DateTime.UtcNow,
                CompletionTime = DateTime.UtcNow.AddHours(-1),
                Successful = false,
            };
            records.Add(record);

            var table = Substitute.For<ITableStorage>();
            table.QueryByPartition<ScheduledTaskEntry>(Arg.Any<string>()).Returns(Task.FromResult<IEnumerable<ScheduledTaskEntry>>(records));

            var core = new Coordinator(table, new TimeSpan(9000));
            var perform = await core.Check(this.GetType());

            Assert.IsTrue(perform);

            table.Received().QueryByPartition<ScheduledTaskEntry>(Arg.Any<string>());
        }
Пример #3
0
 public async Task CheckTypeNull()
 {
     var table = Substitute.For<ITableStorage>();
     var core = new Coordinator(table, new TimeSpan(9000));
     await core.Check(null);
 }
Пример #4
0
 public void ConstructorTableNull()
 {
     var core = new Coordinator(null, new TimeSpan(9000));
 }
Пример #5
0
 public void ConstructorTimeSpanZero()
 {
     var table = Substitute.For<ITableStorage>();
     var core = new Coordinator(table, TimeSpan.Zero);
 }
Пример #6
0
        public async Task Compelete()
        {
            var table = Substitute.For<ITableStorage>();
            table.InsertOrReplace(Arg.Any<ScheduledTaskEntry>());

            var core = new Coordinator(table, new TimeSpan(9000));
            await core.Complete(this.GetType(), Guid.NewGuid(), DateTime.UtcNow, DateTime.UtcNow, true);

            table.Received().InsertOrReplace(Arg.Any<ScheduledTaskEntry>());
        }
Пример #7
0
 public async Task CompeleteIdentifierEmpty()
 {
     var table = Substitute.For<ITableStorage>();
     var core = new Coordinator(table, new TimeSpan(9000));
     await core.Complete(this.GetType(), Guid.Empty, DateTime.UtcNow, DateTime.UtcNow, true);
 }
Пример #8
0
 public async Task CompeleteTypeNull()
 {
     var table = Substitute.For<ITableStorage>();
     var core = new Coordinator(table, new TimeSpan(9000));
     await core.Complete(null, Guid.NewGuid(), DateTime.UtcNow, DateTime.UtcNow, true);
 }
Пример #9
0
 public async Task StartTypeNull()
 {
     var table = Substitute.For<ITableStorage>();
     var core = new Coordinator(table, new TimeSpan(9000));
     await core.Start(null, Guid.NewGuid(), DateTime.UtcNow);
 }
Пример #10
0
 public void InitializeTask()
 {
     var table = Substitute.For<ITableStorage>();
     var core = new Coordinator(table, new TimeSpan(9000));
     var init = core.InitializeTask();
     Assert.IsNotNull(init);
     Assert.IsNotNull(init as InitializeStorageTask);
 }