public void RemoveUserTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); ctx.Add(u1); ctx.Remove(u1); Assert.AreEqual(0, ctx.Users.Length, "user count wrong"); Assert.IsFalse(UserExists(ctx, u1), "user is found"); Assert.IsTrue(((TvCardContext)ctx).UsersOld.Contains(u1), "user not found in history"); }
public void RemoveUserChangeOwnerShipToSchedulerTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); IUser u2 = new User("u2", false, 1); IUser scheduler = new User("scheduler", true, 1); ctx.Add(u1); ctx.Add(u2); ctx.Add(scheduler); ctx.Lock(scheduler); //set ownership ctx.Remove(u2); Assert.IsTrue(ctx.IsOwner(scheduler), "scheduler user is not owner"); }
public void ExistingUserSetTimeshiftStoppedReasonTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); ctx.Add(u1); User u2 = new User("u1", false, 1); ctx.SetTimeshiftStoppedReason(u2,TvStoppedReason.KickedByAdmin); ctx.Remove(u1); Assert.AreEqual(TvStoppedReason.KickedByAdmin, ctx.GetTimeshiftStoppedReason(u2), "tvstoppedreason not the same"); }
public void NonExistingUserSetTimeshiftStoppedReasonTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); u1.SubChannel = 2; ctx.Add(u1); User u2 = new User("u2", false, 2); ctx.SetTimeshiftStoppedReason(u2, TvStoppedReason.KickedByAdmin); ctx.Remove(u1); Assert.AreEqual(TvStoppedReason.UnknownReason, ctx.GetTimeshiftStoppedReason(u1), "tvstoppedreason the same"); }
public void RemoveOneOfManyUserNotOwnerTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); ctx.Add(u1); User u2 = new User("u2", false, 2); ctx.Add(u2); ctx.Remove(u1); Assert.IsTrue(ctx.IsOwner(u2), "user is not owner"); }
public void RemoveOneOnlyUserNoOwnerTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); ctx.Add(u1); ctx.Remove(u1); Assert.IsTrue(ctx.IsOwner(u1), "user is owner"); }
public void RemoveNonExistingUserTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); User u2 = new User("u2", false, 2); ctx.Add(u1); ctx.Remove(u2); Assert.IsFalse(((TvCardContext)ctx).UsersOld.Contains(u1), "user found in history"); Assert.IsFalse(((TvCardContext)ctx).UsersOld.Contains(u2), "user found in history"); }
public void RemoveAdminUserNotInHistoryTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", true, 1); ctx.Add(u1); ctx.Remove(u1); Assert.IsFalse(((TvCardContext)ctx).UsersOld.Contains(u1), "user found in history"); }
public void RemoveUserChangeOwnerShipToUserTest() { ITvCardContext ctx = new TvCardContext(); IUser u1 = new User("u1", false, 1); IUser u2 = new User("u2", false, 1); IUser u3 = new User("u3", false, 1); ctx.Add(u1); ctx.Add(u2); ctx.Add(u3); ctx.Lock(u3); //set ownership ctx.Remove(u3); Assert.IsTrue(ctx.IsOwner(u1), "user1 user is not owner"); }