コード例 #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);
 }