public void StoreNotValidTest()
 {
     storeDbMocker.Setup(x => x.IsStoreExistAndActive(store)).Returns(false);
     slave = new ViewPromotionHistorySlave(store, userServiceMocker.Object, storeDbMocker.Object);
     slave.ViewPromotionHistory();
     Assert.AreEqual((int)StoreEnum.StoreNotExists, slave.Answer.Status);
 }
 public void NoPermissionToViewPromotionHistoryTest()
 {
     storeDbMocker.Setup(x => x.IsStoreExistAndActive(store)).Returns(true);
     userServiceMocker.Setup(x => x.CanPromoteStoreOwner()).Throws(new MarketException(0, ""));
     slave = new ViewPromotionHistorySlave(store, userServiceMocker.Object, storeDbMocker.Object);
     slave.ViewPromotionHistory();
     Assert.AreEqual((int)StoreEnum.NoPermission, slave.Answer.Status);
 }
        public void ViewPromotionHistorySuccessTest()
        {
            storeDbMocker.Setup(x => x.IsStoreExistAndActive(store)).Returns(true);

            var expected = new[]
            {
                "some history",
                "some more history"
            };

            storeDbMocker.Setup(x => x.GetPromotionHistory(store)).Returns(expected);

            slave = new ViewPromotionHistorySlave(store, userServiceMocker.Object, storeDbMocker.Object);
            slave.ViewPromotionHistory();
            Assert.AreEqual((int)StoreEnum.Success, slave.Answer.Status);
            var actual = slave.Answer.ReportList;

            Assert.AreEqual(expected.Length, actual.Length);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }