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); } }
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); } }
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); } }
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; }
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); } }
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); }