public void ApplicationCount() { var userId = Guid.NewGuid(); var table = new AzureTable <ApplicationInfoData>(CloudStorageAccount.DevelopmentStorageAccount); var random = new Random(); var expectedCount = random.Next(15); for (int i = 0; i < expectedCount; i++) { var ua = new ApplicationInfoData(Guid.NewGuid()) { Owner = userId, }; table.AddOrUpdateEntity(ua); } var user = new User() { Identifier = userId, }; var appCore = new ApplicationCore(); var count = appCore.ApplicationCount(user); Assert.AreEqual <int>(expectedCount, count); }
public void ApplicationId() { var appId = Guid.NewGuid(); var appInfo = new ApplicationInfoData(appId); Assert.AreEqual <Guid>(appId, appInfo.ApplicationId); }
public void LastUpdatedOn() { var lastUpdatedOn = DateTime.UtcNow; var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.LastUpdatedOn = lastUpdatedOn; Assert.AreEqual <DateTime>(lastUpdatedOn, appInfo.LastUpdatedOn); }
public void Owner() { var owner = Guid.NewGuid(); var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.Owner = owner; Assert.AreEqual <Guid>(owner, appInfo.Owner); }
public void CreatedBy() { var createdBy = Guid.NewGuid(); var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.CreatedBy = createdBy; Assert.AreEqual <Guid>(createdBy, appInfo.CreatedBy); }
public void CreatedOn() { var createdOn = DateTime.UtcNow; var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.CreatedOn = createdOn; Assert.AreEqual <DateTime>(createdOn, appInfo.CreatedOn); }
public void Description() { var description = StringHelper.ValidString(); var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.Description = description; Assert.AreEqual <string>(description, appInfo.Description); }
public void PublicKey() { var name = StringHelper.ValidString(); var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.PublicKey = name; Assert.AreEqual <string>(name, appInfo.PublicKey); }
public void Environment() { var environment = StringHelper.ValidString(); var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.Environment = environment; Assert.AreEqual <string>(environment, appInfo.Environment); }
public void LastUpdatedBy() { var lastUpdatedBy = Guid.NewGuid(); var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.LastUpdatedBy = lastUpdatedBy; Assert.AreEqual <Guid>(lastUpdatedBy, appInfo.LastUpdatedBy); }
public void Deleted() { var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.Deleted = true; Assert.IsTrue(appInfo.Deleted); appInfo.Deleted = false; Assert.IsFalse(appInfo.Deleted); }
public void Active() { var appInfo = new ApplicationInfoData(Guid.NewGuid()); appInfo.Active = true; Assert.IsTrue(appInfo.Active); appInfo.Active = false; Assert.IsFalse(appInfo.Active); }
private ApplicationInfoData Get(ApplicationInfoData data) { Contract.Requires <ArgumentNullException>(null != data); Contract.Requires <ArgumentOutOfRangeException>(!string.IsNullOrWhiteSpace(data.RowKey)); Contract.Requires <ArgumentOutOfRangeException>(null != data.PartitionKey); Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != data.ApplicationId); using (new PerformanceMonitor()) { var table = new AzureTable <ApplicationInfoData>(ServerConfiguration.Default); try { return(table.QueryBy(data.PartitionKey, data.RowKey)); } catch (DataServiceQueryException) { //Way too much logging going on. } return(null); } }
public void Convert() { var appInfo = new ApplicationInfoData(Guid.NewGuid()) { Deleted = true, Active = true, Description = StringHelper.ValidString(), Environment = StringHelper.ValidString(), Name = StringHelper.ValidString(), PublicKey = StringHelper.ValidString(), Owner = Guid.NewGuid(), }; var converted = appInfo.Convert(); Assert.AreEqual <bool>(appInfo.Active, converted.Active); Assert.AreEqual <bool>(appInfo.Deleted, converted.Deleted); Assert.AreEqual <string>(appInfo.Description, converted.Description); Assert.AreEqual <string>(appInfo.Environment, converted.Environment); Assert.AreEqual <string>(appInfo.Name, converted.Name); Assert.AreEqual <string>(appInfo.PublicKey, converted.PublicKey); Assert.AreEqual <Guid>(appInfo.Owner, converted.OwnerId); }
public ApplicationInformation Get(Abc.Services.Contracts.Application data) { Contract.Requires <ArgumentNullException>(null != data); Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != data.Identifier); using (new PerformanceMonitor()) { ApplicationInformation applicationInformation = null; var table = new AzureTable <ApplicationInfoData>(ServerConfiguration.Default); var info = new ApplicationInfoData(data.Identifier); var savedInfo = table.QueryBy(info.PartitionKey, info.RowKey); applicationInformation = (null == savedInfo) ? new ApplicationInformation() : savedInfo.Convert(); var allApps = app.Search(); var details = from item in allApps where item.ApplicationId == data.Identifier select item; applicationInformation.Load(details.FirstOrDefault()); return(applicationInformation); } }