Пример #1
0
        public void GetUserTree_WhenDataFound_CheckCount()
        {
            //arrange
            var users = FakeStuffs.GetGenericUserStubs();

            _repository.Get().ReturnsForAnyArgs(users);

            //assert
            var results = _bll.GetUsers();

            //act
            Assert.AreEqual(users.Count(), results.Count);
        }
Пример #2
0
        public void getProduction_WhenDataFound_ChcekCount()
        {
            //arrange
            var dailyProd = FakeStuffs.GetDailyProductionList();
            var input     = new ProductionGetByParamInput();

            //act
            _repository.Get().ReturnsForAnyArgs(dailyProd);
            var result = _productionBll.GetAllByParam(input);

            //assert
            Assert.AreEqual(dailyProd.Count(), result.Count);
        }
Пример #3
0
        public void SetUp()
        {
            EMSWebsiteMapper.Initialize();

            _logger     = Substitute.For <ILogger>();
            _uow        = Substitute.For <IUnitOfWork>();
            _repository = Substitute.For <IGenericRepository <T001> >();
            var companyData = FakeStuffs.GetCompany();

            _uow.GetGenericRepository <T001>().ReturnsForAnyArgs(_repository);
            _repository.GetQuery().ReturnsForAnyArgs(companyData.AsQueryable());

            _companyBll = new CompanyBLL(_uow, _logger);
        }
Пример #4
0
        public void GetMonthAllTest()
        {
            _repositoryMonth = Substitute.For <IGenericRepository <MONTH> >();
            _uow.GetGenericRepository <MONTH>().ReturnsForAnyArgs(_repositoryMonth);
            _monthBll = new MonthBLL(_uow, _logger);
            var monthFake = FakeStuffs.GetMonths();

            _repositoryMonth.Get().ReturnsForAnyArgs(monthFake);
            var actualResult = GlobalFunctions.GetMonthList(_monthBll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, monthFake.ToList()[0].MONTH_NAME_ENG);
            Assert.AreEqual(firstItemValue, monthFake.ToList()[0].MONTH_ID.ToString());
        }
Пример #5
0
        public void GetNppbkcAllTest()
        {
            _repositoryNppbkc = Substitute.For <IGenericRepository <ZAIDM_EX_NPPBKC> >();
            _uow.GetGenericRepository <ZAIDM_EX_NPPBKC>().ReturnsForAnyArgs(_repositoryNppbkc);
            _nppbkcbll = new ZaidmExNPPBKCBLL(_uow, _logger);
            var nppbkcFake = FakeStuffs.GetNppbkc();

            _repositoryNppbkc.Get().ReturnsForAnyArgs(nppbkcFake);
            var actualResult = GlobalFunctions.GetNppbkcAll(_nppbkcbll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, nppbkcFake.ToList()[0].NPPBKC_ID);
            Assert.AreEqual(firstItemValue, nppbkcFake.ToList()[0].NPPBKC_ID);
        }
Пример #6
0
        public void GetPoaAllTest()
        {
            var poaFake = FakeStuffs.GetPOA();

            _repositoryPoa = Substitute.For <IGenericRepository <POA> >();
            _uow.GetGenericRepository <POA>().ReturnsForAnyArgs(_repositoryPoa);
            _poabll = new POABLL(_uow, _logger);

            _repositoryPoa.Get().ReturnsForAnyArgs(poaFake);
            var actualResult   = GlobalFunctions.GetPoaAll(_poabll);
            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, poaFake.ToList()[0].PRINTED_NAME);
            Assert.AreEqual(firstItemValue, poaFake.ToList()[0].POA_ID);
        }
Пример #7
0
        public void GetProdTypeTest()
        {
            _repositoryProdType = Substitute.For <IGenericRepository <ZAIDM_EX_PRODTYP> >();
            _uow.GetGenericRepository <ZAIDM_EX_PRODTYP>().ReturnsForAnyArgs(_repositoryProdType);
            _prodTypeBll = new ZaidmExProdTypeBLL(_uow, _logger);
            var ptypeFake = FakeStuffs.GetProdTypList();

            _repositoryProdType.Get().ReturnsForAnyArgs(ptypeFake);
            var actualResult = GlobalFunctions.GetProductCodeList(_prodTypeBll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, ptypeFake.ToList()[0].PROD_CODE + "-" + ptypeFake.ToList()[0].PRODUCT_TYPE + " [" + ptypeFake.ToList()[0].PRODUCT_ALIAS + "]");
            Assert.AreEqual(firstItemValue, ptypeFake.ToList()[0].PROD_CODE);
        }
Пример #8
0
        public void GetSeriesTest()
        {
            _repositorySeries = Substitute.For <IGenericRepository <ZAIDM_EX_SERIES> >();
            _uow.GetGenericRepository <ZAIDM_EX_SERIES>().ReturnsForAnyArgs(_repositorySeries);
            _masterDataBll = new MasterDataBLL(_uow);
            var seriesFake = FakeStuffs.GetSeriesList();

            _repositorySeries.Get().ReturnsForAnyArgs(seriesFake);
            var actualResult = GlobalFunctions.GetSeriesCodeList(_masterDataBll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, seriesFake.ToList()[0].SERIES_CODE + "-" + seriesFake.ToList()[0].SERIES_VALUE);
            Assert.AreEqual(firstItemValue, seriesFake.ToList()[0].SERIES_CODE);
        }
Пример #9
0
        public void GetMarketTest()
        {
            _repositoryMarket = Substitute.For <IGenericRepository <ZAIDM_EX_MARKET> >();
            _uow.GetGenericRepository <ZAIDM_EX_MARKET>().ReturnsForAnyArgs(_repositoryMarket);
            _masterDataBll = new MasterDataBLL(_uow);
            var marketFake = FakeStuffs.GetMarketList();

            _repositoryMarket.Get().ReturnsForAnyArgs(marketFake);
            var actualResult = GlobalFunctions.GetMarketCodeList(_masterDataBll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, marketFake.ToList()[0].MARKET_ID + "-" + marketFake.ToList()[0].MARKET_DESC);
            Assert.AreEqual(firstItemValue, marketFake.ToList()[0].MARKET_ID);
        }
Пример #10
0
        public void GetUomTest()
        {
            _repositoryUom = Substitute.For <IGenericRepository <UOM> >();
            _uow.GetGenericRepository <UOM>().ReturnsForAnyArgs(_repositoryUom);
            _unitOfMeasurementBll = new UnitOfMeasurementBLL(_uow, _logger);
            var uomFake = FakeStuffs.GetUomList();

            _repositoryUom.Get().ReturnsForAnyArgs(uomFake);
            var actualResult = GlobalFunctions.GetUomList(_unitOfMeasurementBll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, uomFake.ToList()[0].UOM_DESC);
            Assert.AreEqual(firstItemValue, uomFake.ToList()[0].UOM_ID);
        }
Пример #11
0
        public void GetGoodsTypeTest()
        {
            _repositoryGoodsType = Substitute.For <IGenericRepository <ZAIDM_EX_GOODTYP> >();
            _uow.GetGenericRepository <ZAIDM_EX_GOODTYP>().ReturnsForAnyArgs(_repositoryGoodsType);
            _goodTypeBll = new ZaidmExGoodTypeBLL(_uow, _logger);
            var goodTypeFake = FakeStuffs.GetGoodTypes();

            _repositoryGoodsType.Get().ReturnsForAnyArgs(goodTypeFake);
            var actualResult = GlobalFunctions.GetGoodTypeList(_goodTypeBll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, goodTypeFake.ToList()[0].EXC_GOOD_TYP + "-" + goodTypeFake.ToList()[0].EXT_TYP_DESC);
            Assert.AreEqual(firstItemValue, goodTypeFake.ToList()[0].EXC_GOOD_TYP);
        }
Пример #12
0
        public void GetSupplierPortAll()
        {
            _repositorySupplier = Substitute.For <IGenericRepository <SUPPLIER_PORT> >();
            _uow.GetGenericRepository <SUPPLIER_PORT>().ReturnsForAnyArgs(_repositorySupplier);
            _supplierPortBll = new SupplierPortBLL(_uow, _logger);
            var supplierPortFake = FakeStuffs.GetSupplierPorts();

            _repositorySupplier.Get().ReturnsForAnyArgs(supplierPortFake);
            var actualResult = GlobalFunctions.GetSupplierPortList(_supplierPortBll);

            var firstItemText  = actualResult.ToList()[0].Text;
            var firstItemValue = actualResult.ToList()[0].Value;

            Assert.AreEqual(firstItemText, supplierPortFake.ToList()[0].PORT_NAME);
            Assert.AreEqual(firstItemValue, supplierPortFake.ToList()[0].SUPPLIER_PORT_ID.ToString());
        }