예제 #1
0
        public void Return_List_Of_ProgressiveTaxRates_When_Called()
        {
            //map classes
            _mapper = new Mapper(new MapperConfiguration(cfg =>
                                                         cfg.CreateMap <ProgressiveTaxRate, Dto.DataAccess.ProgressiveTaxRate>()
                                                         ));
            // instantiate data access class
            _taxDataAccess = new TaxDataAccess(_taxAdministrationContext.Object, _mapper);

            _mockProgressiveTaxRate = new Mock <DbSet <ProgressiveTaxRate> >();
            _mockProgressiveTaxRate.As <IQueryable <ProgressiveTaxRate> >().Setup(m => m.Provider).Returns(_queryableProgressiveTaxRate.Provider);
            _mockProgressiveTaxRate.As <IQueryable <ProgressiveTaxRate> >().Setup(m => m.Expression).Returns(_queryableProgressiveTaxRate.Expression);
            _mockProgressiveTaxRate.As <IQueryable <ProgressiveTaxRate> >().Setup(m => m.ElementType).Returns(_queryableProgressiveTaxRate.ElementType);
            _mockProgressiveTaxRate.As <IQueryable <ProgressiveTaxRate> >().Setup(m => m.GetEnumerator()).Returns(_queryableProgressiveTaxRate.GetEnumerator);

            _taxAdministrationContext.Setup(m => m.ProgressiveTaxRate).Returns(_mockProgressiveTaxRate.Object);

            Assert.IsTrue(_taxDataAccess.GetProgressiveTaxRates().Count > 0);
        }