public void ObjectTest() { var role = new Role() { Name = "Role1", Description = "Some description." }; CacheManager.Set("role", role); Role cached = CacheManager.Get<Role>("role"); Assert.AreEqual("Role1", cached.Name); }
public void TestFixtureSetUp() { // setup memcached _memcached = Process.Start( @"..\..\..\..\Libraries\memcached.exe", "-vv -p 11200"); using (var db = new TrackerDataContext()) { var role1 = new Role { Name = "Test Role" }; var role2 = new Role { Name = "Duck Roll" }; db.Role.InsertOnSubmit(role1); db.Role.InsertOnSubmit(role2); db.SubmitChanges(); _roleIds.Add(role1.Id); _roleIds.Add(role2.Id); } }
public void TestFixtureSetUp() { using (var db = new TrackerDataContext { Log = Console.Out }) { var role1 = new Role { Name = "Test Role" }; var role2 = new Role { Name = "Duck Roll" }; db.Role.InsertOnSubmit(role1); db.Role.InsertOnSubmit(role2); db.SubmitChanges(); _roleIds.Add(role1.Id); _roleIds.Add(role2.Id); } }
public void ObjectPerfTest() { int count = 1000; var timer = new Stopwatch(); timer.Start(); for (int i = 0; i < count; i++) { var role = new Role { Name = "Role" + i, Description = "Some description." }; CacheManager.Set("role", role); Role cached = CacheManager.Get<Role>("role"); Assert.AreEqual("Role" + i, cached.Name); } timer.Stop(); double average = (double)timer.ElapsedMilliseconds / count; Console.WriteLine("Total: " + FormatTimeSpan(timer.Elapsed) + " Average: " + average + "ms"); }
partial void OnRoleChanging(Role value);
private void OnRoleListRemove(Role entity) { SendPropertyChanging(null); var userRole = UserRoleList.FirstOrDefault(c => c.UserId == Id && c.RoleId == entity.Id); UserRoleList.Remove( userRole); SendPropertyChanged(null); }
private void OnRoleListAdd(Role entity) { SendPropertyChanging(null); UserRoleList.Add(new UserRole { User = this, Role = entity }); SendPropertyChanged(null); }