예제 #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);
        }
예제 #2
0
        public PdfShartBll(IConfigurationBll configurationBll, IProductsBll productBll, ITransactionsBll transactionsBll)
        {
            if (configurationBll == null)
            {
                throw new ArgumentNullException("configurationBll");
            }
            if (productBll == null)
            {
                throw new ArgumentNullException("productBll");
            }
            if (transactionsBll == null)
            {
                throw new ArgumentNullException("transactionsBll");
            }

            _productsBll      = productBll;
            _configurationBll = configurationBll;
            _transactionsBll  = transactionsBll;
        }
예제 #3
0
        public void Init()
        {
            Mock <IProductsDal> productsDal = new Mock <IProductsDal>();
            Mock <IPosDal>      posDal      = new Mock <IPosDal>();

            productsDal
            .Setup(x => x.SaveProductInformationFromPos(It.IsAny <ProductBdo>(), It.IsAny <PosBdo>()))
            .Returns((ProductBdo product, PosBdo pos) => product);

            _productsBll = new ProductsBll(BllFactory.Current.GiftValidationBll, BllFactory.Current.SecurityBll, productsDal.Object, posDal.Object);

            _posResponse.PosId              = 1005;
            _posResponse.ProductName        = "Gilus prisilietimas";
            _posResponse.ProductDuration    = "56 min";
            _posResponse.ProductDescription = "No descriptions";

            _posResponse.Locations = new List <ProductServiceLocation>();
            _posResponse.Locations.Add(new ProductServiceLocation {
                Id = 1, Name = "LocName", City = "Wilno", Address = "Juozapavi\u010diaus g. 9A - 174"
            });
        }