public void TruncateAtWordShouldWorkCorrectlyWithMilliseconds() { var service = new TimeSpanService(); Assert.Equal("a bit", service.GetTimeSince(DateTime.UtcNow.Subtract(TimeSpan.FromMilliseconds(10)))); Assert.Equal("a bit", service.GetTimeSince(DateTime.UtcNow.Subtract(TimeSpan.FromMilliseconds(20)))); }
public void TruncateAtWordShouldWorkCorrectlyWithSeconds() { var service = new TimeSpanService(); Assert.Equal("1 seconds", service.GetTimeSince(DateTime.UtcNow.Subtract(TimeSpan.FromSeconds(1)))); Assert.Equal("2 seconds", service.GetTimeSince(DateTime.UtcNow.Subtract(TimeSpan.FromSeconds(2)))); }
private void updateUpdatedProperty <T>() where T : class { var modifiedSourceInfo = ChangeTracker.Entries <T>() .Where(e => e.State == EntityState.Added || e.State == EntityState.Modified); foreach (var entry in modifiedSourceInfo) { entry.Property("PublishTimeStamp").CurrentValue = TimeSpanService.GetCurrentTimeUnix(); } }
public DeliveryController() { _cityService = new CityService(); _timeSpanService = new TimeSpanService(); _deliveryService = new DeliveryService(); }