Beispiel #1
0
        /// <summary>
        /// Delete Tesing Data
        /// </summary>
        private static void DeleteData()
        {
            var token = new Abc.Services.Contracts.Token()
            {
                ApplicationId = Settings.ApplicationIdentifier,
            };
            var source = new Abc.Services.Core.LogCore();

            var perf = new Abc.Services.Contracts.Occurrence()
            {
                Token      = token,
                OccurredOn = DateTime.UtcNow.AddDays(-1),
            };

            source.Delete(perf);

            var err = new Abc.Services.Contracts.ErrorItem()
            {
                Token      = token,
                OccurredOn = DateTime.UtcNow.AddDays(-1),
            };

            source.Delete(err);

            var msg = new Abc.Services.Contracts.Message()
            {
                Token      = token,
                OccurredOn = DateTime.UtcNow.AddDays(-1),
            };

            source.Delete(msg);
        }
        public void CleanUp()
        {
            var source = new LogCore();
            var token  = new Abc.Services.Contracts.Token()
            {
                ApplicationId = Settings.ApplicationIdentifier,
            };
            var message = new Abc.Services.Contracts.Message()
            {
                Token      = token,
                OccurredOn = DateTime.UtcNow,
            };

            source.Delete(message);
        }
Beispiel #3
0
        public void Initialize()
        {
            try
            {
                var token = new Abc.Services.Contracts.Token()
                {
                    ApplicationId = Settings.ApplicationIdentifier,
                };
                var perf = new Abc.Services.Contracts.Occurrence()
                {
                    Token      = token,
                    OccurredOn = DateTime.UtcNow,
                };

                var source = new Abc.Services.Core.LogCore();
                source.Delete(perf);
            }
            catch
            {
            }
        }
        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());
            }
        }