public void NotSystemAdminTest() { userAdminMocker.Setup(x => x.GetAdminName()).Returns("Moshe"); userAdminMocker.Setup(x => x.ValidateSystemAdmin()).Throws(new MarketException((int)ViewSystemErrorStatus.NotSystemAdmin, "")); adminDbMocker.Setup(x => x.IsUserExist(It.IsAny <string>())).Returns(true); slave = new ViewErrorSlave(adminDbMocker.Object, userAdminMocker.Object); slave.ViewError(); Assert.AreEqual((int)ViewSystemErrorStatus.NotSystemAdmin, slave.Answer.Status); }
public void ViewErrorsSuccessTest() { userAdminMocker.Setup(x => x.GetAdminName()).Returns("Moshe"); adminDbMocker.Setup(x => x.IsUserExist(It.IsAny <string>())).Returns(true); slave = new ViewErrorSlave(adminDbMocker.Object, userAdminMocker.Object); slave.ViewError(); Assert.AreEqual((int)ViewSystemErrorStatus.Success, slave.Answer.Status); var actual = slave.Answer.ReportList; Assert.AreEqual(expectedErrors.Length, actual.Length); for (int i = 0; i < expectedErrors.Length; i++) { Assert.AreEqual(expectedErrors[i], actual[i]); } }