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>()); }
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>()); }
public async Task CheckTypeNull() { var table = Substitute.For<ITableStorage>(); var core = new Coordinator(table, new TimeSpan(9000)); await core.Check(null); }
public void ConstructorTableNull() { var core = new Coordinator(null, new TimeSpan(9000)); }
public void ConstructorTimeSpanZero() { var table = Substitute.For<ITableStorage>(); var core = new Coordinator(table, TimeSpan.Zero); }
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>()); }
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); }
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); }
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); }
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); }