本文整理汇总了C#中IClock.GetUtcTime方法的典型用法代码示例。如果您正苦于以下问题:C# IClock.GetUtcTime方法的具体用法?C# IClock.GetUtcTime怎么用?C# IClock.GetUtcTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IClock
的用法示例。
在下文中一共展示了IClock.GetUtcTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
fileSystem = Substitute.For<ICalamariFileSystem>();
deploymentJournal = Substitute.For<IDeploymentJournal>();
clock = Substitute.For<IClock>();
retentionPolicy = new RetentionPolicy(fileSystem, deploymentJournal, clock);
now = new DateTimeOffset(new DateTime(2015, 01, 15), new TimeSpan(0, 0, 0));
clock.GetUtcTime().Returns(now);
// Deployed 4 days prior to 'now'
fourDayOldDeployment = new JournalEntry("fourDayOld", "blah", "blah", "blah", "blah", policySet1,
now.AddDays(-4).LocalDateTime,
"C:\\packages\\Acme.1.0.0.nupkg", "C:\\Applications\\Acme.1.0.0", null, true);
// Deployed 4 days prior to 'now' but to the same location as the latest successful deployment
fourDayOldSameLocationDeployment = new JournalEntry("twoDayOld", "blah", "blah", "blah", "blah", policySet1,
now.AddDays(-4).LocalDateTime,
"C:\\packages\\Acme.1.2.0.nupkg", "C:\\Applications\\Acme.1.2.0", null, true);
// Deployed 3 days prior to 'now'
threeDayOldDeployment = new JournalEntry("threeDayOld", "blah", "blah", "blah", "blah", policySet1,
now.AddDays(-3).LocalDateTime,
"C:\\packages\\Acme.1.1.0.nupkg", "C:\\Applications\\Acme.1.1.0", null, true);
// Deployed 2 days prior to 'now'
twoDayOldDeployment = new JournalEntry("twoDayOld", "blah", "blah", "blah", "blah", policySet1,
now.AddDays(-2).LocalDateTime,
"C:\\packages\\Acme.1.2.0.nupkg", "C:\\Applications\\Acme.1.2.0", null, true);
// Deployed (unsuccessfully) 1 day prior to 'now'
oneDayOldUnsuccessfulDeployment = new JournalEntry("oneDayOldUnsuccessful", "blah", "blah", "blah", "blah", policySet1,
now.AddDays(-1).LocalDateTime,
"C:\\packages\\Acme.1.3.0.nupkg", "C:\\Applications\\Acme.1.3.0", null, false);
// Deployed 5 days prior to 'now', but has a different policy-set
fiveDayOldNonMatchingDeployment = new JournalEntry("fiveDayOld", "blah", "blah", "blah", "blah", policySet2,
now.AddDays(-5).LocalDateTime,
"C:\\packages\\Beta.1.0.0.nupkg", "C:\\Applications\\Beta.1.0.0", null, true);
var journalEntries = new List<JournalEntry>
{
fiveDayOldNonMatchingDeployment,
fourDayOldDeployment,
threeDayOldDeployment,
twoDayOldDeployment,
oneDayOldUnsuccessfulDeployment
};
deploymentJournal.GetAllJournalEntries().Returns(journalEntries);
foreach (var journalEntry in journalEntries)
{
fileSystem.FileExists(journalEntry.ExtractedFrom).Returns(true);
fileSystem.DirectoryExists(journalEntry.ExtractedTo).Returns(true);
}
}