public async Task GetForDateRangeAsync() { var timeStamp = new DateTime(2018, 10, 1, 1, 0, 0); var archiveEntry = new DeviceArchive { DeviceConfigurationId = Guid.NewGuid().ToId(), DeviceConfigurationVersionId = 1.0, DeviceId = Guid.NewGuid().ToId(), MessageId = Guid.NewGuid().ToId(), MetaData = "meta data", PartitionKey = Guid.NewGuid().ToId(), RowKey = Guid.NewGuid().ToId(), PEMMessageId = Guid.NewGuid().ToId(), Timestamp = timeStamp.ToJSONString() }; await DataFactory.DeviceArchiveRepoProxy.AddArchiveAsync(DataFactory.DeviceRepo, archiveEntry); timeStamp = new DateTime(2018, 10, 1, 2, 0, 0); archiveEntry.Timestamp = timeStamp.ToJSONString(); archiveEntry.RowKey = Guid.NewGuid().ToId(); await DataFactory.DeviceArchiveRepoProxy.AddArchiveAsync(DataFactory.DeviceRepo, archiveEntry); var listRequest = new ListRequest { PageIndex = 1, PageSize = 25, StartDate = timeStamp.AddDays(-2).ToJSONString() }; var response = await DataFactory.DeviceArchiveRepoProxy.GetForDateRangeAsync(DataFactory.DeviceRepo, archiveEntry.DeviceId, listRequest); Assert.IsTrue(response.Successful); Assert.IsTrue(response.Model.Count() > 0); }
public async Task AddArchiveAsync() { var archiveEntry = new DeviceArchive { DeviceConfigurationId = Guid.NewGuid().ToId(), DeviceConfigurationVersionId = 1.0, DeviceId = Guid.NewGuid().ToId(), MessageId = Guid.NewGuid().ToId(), MetaData = "meta data", PartitionKey = Guid.NewGuid().ToId(), RowKey = Guid.NewGuid().ToId(), PEMMessageId = Guid.NewGuid().ToId(), Timestamp = DateTime.UtcNow.ToJSONString() }; await DataFactory.DeviceArchiveRepoProxy.AddArchiveAsync(DataFactory.DeviceRepo, archiveEntry); }
public Task AddArchiveAsync(string instanceId, DeviceArchive archiveEntry, EntityHeader org, EntityHeader user) { throw new NotImplementedException("Should not add archives via connector for remote instances, should call local method."); }
public async Task <InvokeResult> AddArchiveAsync(DeviceRepository deviceRepo, DeviceArchive logEntry, EntityHeader org, EntityHeader user) { await GetDeviceArchivepRepo(deviceRepo).AddArchiveAsync(deviceRepo, logEntry); return(InvokeResult.Success); }
public async Task <InvokeResult> AddArchiveAsync(DeviceRepository deviceRepo, DeviceArchive logEntry, EntityHeader org, EntityHeader user) { if (deviceRepo.RepositoryType.Value == RepositoryTypes.Local) { await _archiveConnector.AddArchiveAsync(deviceRepo.Instance.Id, logEntry, org, user); } else { await _archiveRepo.AddArchiveAsync(deviceRepo, logEntry); } return(InvokeResult.Success); }