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