Exemplo n.º 1
0
 public void NoStoreTest()
 {
     adminDbMocker.Setup(x => x.IsStoreExistInHistory(It.IsAny <string>()))
     .Returns(false);
     adminDbMocker.Setup(x => x.IsUserExist(It.IsAny <string>())).Returns(true);
     slave = new AdminViewPurchaseHistorySlave(adminDbMocker.Object, userAdminMocker.Object);
     slave.ViewPurchaseHistoryByStore("who?");
     Assert.AreEqual((int)ViewPurchaseHistoryStatus.NoStoreFound, slave.Answer.Status);
 }
Exemplo n.º 2
0
 public void NotSystemAdminTest2()
 {
     adminDbMocker.Setup(x => x.IsStoreExistInHistory(It.IsAny <string>()))
     .Returns(true);
     userAdminMocker.Setup(x => x.ValidateSystemAdmin())
     .Throws(new MarketException((int)ViewPurchaseHistoryStatus.NotSystemAdmin, ""));
     slave = new AdminViewPurchaseHistorySlave(adminDbMocker.Object, userAdminMocker.Object);
     slave.ViewPurchaseHistoryByStore("who?");
     Assert.AreEqual((int)ViewPurchaseHistoryStatus.NotSystemAdmin, slave.Answer.Status);
 }
Exemplo n.º 3
0
 public void ViewPurchaseHistoryByStoreSuccessTest()
 {
     string[] expected = { "some history1", "some history2" };
     adminDbMocker.Setup(x => x.IsStoreExistInHistory(It.IsAny <string>()))
     .Returns(true);
     adminDbMocker.Setup(x => x.GetPurchaseHistory(It.IsAny <string>(), It.IsAny <string>()))
     .Returns(expected);
     slave = new AdminViewPurchaseHistorySlave(adminDbMocker.Object, userAdminMocker.Object);
     slave.ViewPurchaseHistoryByStore("who?");
     string[] actual = slave.Answer.ReportList;
     Assert.AreEqual(expected.Length, actual.Length);
     for (int i = 0; i < expected.Length; i++)
     {
         Assert.AreEqual(expected[i], actual[i]);
     }
 }