Esempio n. 1
0
        public void Same_model_to_save_twice_will_update_the_existed_values()
        {
            var app = new App();

            app.Id    = "Same_model_to_save_twice_will_update_the_existed_values";
            app.Name  = "SameAppToSaveTwice";
            app.Price = 111;

            using (var redis = new RedisService())
            {
                var exited = redis.Get <App>(app.Id);
                redis.Delete <App>(exited);

                redis.Add <App>(app);

                app.Name = "Name1";
                redis.Add <App>(app);

                var getApp = redis.Get <App>(app.Id);

                Assert.NotEmpty(getApp.Name);

                redis.Delete <App>(exited);
            }
        }
        public void Same_model_to_save_twice_will_update_the_existed_values()
        {
            var app = new App();
            app.Id = "Same_model_to_save_twice_will_update_the_existed_values";
            app.Name = "SameAppToSaveTwice";
            app.Price = 111;

            using (var redis = new RedisService())
            {
                var exited = redis.Get<App>(app.Id);
                redis.Delete<App>(exited);

                redis.Add<App>(app);

                app.Name = "Name1";
                redis.Add<App>(app);

                var getApp = redis.Get<App>(app.Id);

                Assert.NotEmpty(getApp.Name);

                redis.Delete<App>(exited);

            }
        }
Esempio n. 3
0
        private void DeleteRedundanceForAppBranch(string appId)
        {
            //delete LogoImage
            var app = RedisService.Get <App>(appId);

            if (app.Logo != null)
            {
                var logoImage = app.Logo;
                RedisService.Delete <ImageInfo>(logoImage);
            }

            //delete ScreenShotImage
            var screenShotImages = app.ScreenShot;

            foreach (var screenShotImage in screenShotImages)
            {
                RedisService.Delete <ImageInfo>(screenShotImage);
            }

            //delete ClientLogosImage
            var clientLogoImages = app.ClientLogos;

            foreach (var clientLogoImage in clientLogoImages)
            {
                RedisService.Delete <ClientImageInfo>(clientLogoImage);
            }
        }
Esempio n. 4
0
        public void update_model_should_throw_exception_if_they_have_differentIds()
        {
            using (var redis = new RedisService())
            {
                var app = new App();
                app.Id   = "update_model_should_throw_exception_if_they_have_differentIds";
                app.Name = "test_update";

                redis.Delete <App>(app);

                redis.Add <App>(app);

                //change the property
                var newApp = new App();
                newApp.Id = "new_update_model_should_throw_exception_if_they_have_differentIds";

                var ex = Assert.Throws <ArgumentException>(() => redis.UpdateWithRebuildIndex <App>(app, newApp));
                Assert.True(ex.Message.Contains("different"));

                redis.Delete <App>(app);
            }
        }
Esempio n. 5
0
 public FunctionOpenResult<bool> UpdateByID(AppToken info) {
     var r = new FunctionOpenResult<bool>();
     r.Data = AppTokenDal.Update(info) > 0;
     if (r.Data&&info.Status)
     {
         RedisService.Set<AppToken>("default", String.Format(ConfigAuthorityCacheKey.AuthorityCacheKey, info.AppId), info);
     }
     else
     {
         RedisService.Delete("default", String.Format(ConfigAuthorityCacheKey.AuthorityCacheKey, info.AppId));
     }
     return r;
 }
Esempio n. 6
0
        public void update_model_should_throw_exception_if_they_have_differentIds()
        {
            using (var redis = new RedisService())
            {
                var app = new App();
                app.Id = "update_model_should_throw_exception_if_they_have_differentIds";
                app.Name = "test_update";

                redis.Delete<App>(app);

                redis.Add<App>(app);

                //change the property
                var newApp = new App();
                newApp.Id = "new_update_model_should_throw_exception_if_they_have_differentIds";

                var ex = Assert.Throws<ArgumentException>(() => redis.UpdateWithRebuildIndex<App>(app, newApp));
                Assert.True(ex.Message.Contains("different"));

                redis.Delete<App>(app);

            }
        }
Esempio n. 7
0
        public void AppProjectDeleteWithEmpty(string appProjectId)
        {
            var tags = AppStoreUIService.GetTagsByAppProject(appProjectId);

            if (tags != null)
            {
                try
                {
                    foreach (var t in tags)
                    {
                        AppStoreUIService.DeleteTagFromAppProject(t.Id, appProjectId);
                    }
                }
                catch (Exception)
                {
                    var appProject_e = RedisService.Get <AppProject>(appProjectId);
                    RedisService.Delete <AppProject>(appProject_e);
                }
            }

            var appProject = RedisService.Get <AppProject>(appProjectId);

            RedisService.Delete <AppProject>(appProject);
        }