Ejemplo n.º 1
0
        public void Init()
        {
            _configBllMock = new Mock<IConfigurationBll>();
            _configBllMock.Setup(x => x.Get())
                .Returns(() => new MySettings {
                    LengthOfPosUid = 32,
                    LengthOfPdfDirectoryName = 5,
                    PathToPdfStorage = "c:\\temp\\giftservice\\trash\\",
                    PathToPosContent = "c:\\_projects\\GiftService\\GiftService.Web\\Content\\"
                });
            _configBllMock.Setup(x => x.GetPdfLayout(It.IsAny<int>()))
                .Returns((int posId) => new PosPdfLayout
                {
                    PosId = posId,
                    FooterImage = "footer.jpg",
                    HeaderImage = "header.jpg"
                });

            _productsDalMock.Setup(x => x.GetProductByUid(It.IsAny<string>()))
                .Returns((string productUid) =>
                {
                    var p = ProductsDalFake.GetProducts().First(x => x.ProductUid == productUid);
                    return p;
                });

            _productsDalMock.Setup(x => x.GetProductByPaySystemUid(It.IsAny<string>()))
                .Returns((string paySystemUid) =>
                {
                    var p = ProductsDalFake.GetProducts().First(x => x.PaySystemUid == paySystemUid);
                    p.PaySystemUid = paySystemUid;
                    return p;
                });

            _productsBll = new ProductsBll(BllFactory.Current.GiftValidationBll, BllFactory.Current.SecurityBll, _productsDalMock.Object, DalFactory.Current.PosDal);

            _transactionsbllMock.Setup(x => x.GetTransactionByPaySystemUid(It.IsAny<string>()))
                .Returns((string paySystemUid) =>
                {
                    var p = ProductsDalFake.GetProducts().First(x => x.PaySystemUid == paySystemUid);
                    return new TransactionBdo
                    {
                        PaySystemUid = paySystemUid,
                        ProductUid = p.ProductUid,
                        OrderNr = String.Concat(p.ProductUid.Substring(0, 3), "-", p.ProductUid.Substring(3, 6)),
                        IsPaymentProcessed = true,
                        IsTestPayment = true
                    };
                });

            //_pdfBll = new PdfBll(_configBllMock.Object, _productsDalMock.Object);
            _pdfSharpBll = new PdfShartBll(_configBllMock.Object, _productsBll, _transactionsbllMock.Object);

            _communicationBll = new CommunicationBll(BllFactory.Current.ConfigurationBll);
        }
Ejemplo n.º 2
0
        public SecurityBll(IConfigurationBll configurationBll, ICommunicationBll communicationBll)
        {
            if (communicationBll == null)
            {
                throw new ArgumentNullException("communicationBll");
            }
            if (configurationBll == null)
            {
                throw new ArgumentNullException("configurationBll");
            }

            _communicationBll = communicationBll;
            _configurationBll = configurationBll;
        }