Exemple #1
0
 public void NoUserToRemoveTest()
 {
     userAdminMocker.Setup(x => x.GetAdminName()).Returns("SleepyAdmin");
     adminDbMocker.Setup(x => x.IsUserExist(It.IsAny <string>())).Returns(false);
     slave = new RemoveUserSlave(adminDbMocker.Object, userAdminMocker.Object);
     slave.RemoveUser("Moshe");
     Assert.AreEqual(slave.Answer.Status, (int)RemoveUserStatus.NoUserFound);
 }
Exemple #2
0
 public void SelfTerminationBlockedTest()
 {
     userAdminMocker.Setup(x => x.GetAdminName()).Returns("Moshe");
     adminDbMocker.Setup(x => x.IsUserExist(It.IsAny <string>())).Returns(true);
     slave = new RemoveUserSlave(adminDbMocker.Object, userAdminMocker.Object);
     slave.RemoveUser("Moshe");
     Assert.AreEqual(slave.Answer.Status, (int)RemoveUserStatus.SelfTermination);
 }
Exemple #3
0
 public void RemoveUserSuccessTest()
 {
     userAdminMocker.Setup(x => x.GetAdminName()).Returns("Moshe");
     adminDbMocker.Setup(x => x.IsUserExist(It.IsAny <string>())).Returns(true);
     slave = new RemoveUserSlave(adminDbMocker.Object, userAdminMocker.Object);
     slave.RemoveUser("who?");
     Assert.AreEqual((int)RemoveUserStatus.Success, slave.Answer.Status);
 }
Exemple #4
0
 public void NotSystemAdminTest()
 {
     userAdminMocker.Setup(x => x.GetAdminName()).Returns("Moshe");
     userAdminMocker.Setup(x => x.ValidateSystemAdmin()).Throws(new MarketException((int)RemoveUserStatus.NotSystemAdmin, ""));
     adminDbMocker.Setup(x => x.IsUserExist(It.IsAny <string>())).Returns(true);
     slave = new RemoveUserSlave(adminDbMocker.Object, userAdminMocker.Object);
     slave.RemoveUser("who?");
     Assert.AreEqual((int)RemoveUserStatus.NotSystemAdmin, slave.Answer.Status);
 }