public void GetConfigurationNull() { using (var client = new DatumClient()) { client.GetConfiguration(null); } }
public void GetConfigurationNullToken() { using (var client = new DatumClient()) { var config = this.Config(); config.Token = null; client.GetConfiguration(config); } }
public void GetConfigurationInvalidValidationKey() { using (var client = new DatumClient()) { var config = this.Config(); config.Token.ValidationKey = StringHelper.NullEmptyWhiteSpace(); var returnedData = client.GetConfiguration(config); Assert.IsNull(returnedData); } }
public void GetConfigurationEmptyApplicationId() { using (var client = new DatumClient()) { var config = this.Config(); config.Token.ApplicationId = Guid.Empty; var returnedData = client.GetConfiguration(config); Assert.IsNull(returnedData); } }
public void GetConfigurationItems() { var user = new UserData(StringHelper.ValidString(), StringHelper.ValidString(), StringHelper.ValidString()); var userTable = new AzureTable <UserData>(CloudStorageAccount.DevelopmentStorageAccount); userTable.AddEntity(user); var userApp = new UserApplicationData(user.Id, user.ApplicationId) { Active = true }; var table = new AzureTable <UserApplicationData>(CloudStorageAccount.DevelopmentStorageAccount); table.AddEntity(userApp); var core = new Abc.Services.Core.ApplicationCore(); var token = new Abc.Services.Contracts.Token() { ApplicationId = userApp.ApplicationId, ValidationKey = application.Token.ValidationKey }; var u = new Abc.Services.Contracts.User() { Identifier = userApp.UserId, }; var a = new Abc.Services.Contracts.Application() { Identifier = token.ApplicationId, }; var editor = new Abc.Services.Contracts.UserApplication() { User = u, Application = a, }; var config1 = new Abc.Services.Contracts.Configuration() { Key = StringHelper.ValidString(63), Value = StringHelper.ValidString(), Token = token, }; var config2 = new Abc.Services.Contracts.Configuration() { Key = StringHelper.ValidString(63), Value = StringHelper.ValidString(), Token = token, }; core.Save(config1, editor); core.Save(config2, editor); var query = new Abc.Test.Services.Client.Datum.Client.Configuration() { Token = new Token(), }; query.Token.ApplicationId = application.Token.ApplicationId; query.Token.ValidationKey = application.Token.ValidationKey; using (var client = new DatumClient()) { var returned = client.GetConfiguration(query); Assert.IsNotNull(returned); var trimmed = from item in returned where (item.Key == config1.Key && item.Value == config1.Value) || (item.Key == config2.Key && item.Value == config2.Value) select item; Assert.AreEqual <int>(2, trimmed.Count()); } }