Пример #1
0
        public void GetTowFiscalYearList_Test()
        {
            #region Data
            int    mrmUserId    = 25;
            string networkLogin = "******";

            var towList = new List <Model.TypeOfWork>();
            towList.Add(new Model.TypeOfWork {
                Id          = 1,
                ChannelId   = 1,
                FiscalYear  = 2014,
                Description = "Tow 1",
                Name        = "Tow 1"
            });

            towList.Add(new Model.TypeOfWork
            {
                Id          = 2,
                ChannelId   = 1,
                FiscalYear  = 2014,
                Description = "Tow 2",
                Name        = "Tow 2"
            });

            towList.Add(new Model.TypeOfWork
            {
                Id          = 3,
                ChannelId   = 1,
                FiscalYear  = 2015,
                Description = "Tow 3",
                Name        = "Tow 3"
            });

            towList.Add(new Model.TypeOfWork
            {
                Id          = 4,
                ChannelId   = 2,
                FiscalYear  = 2015,
                Description = "Tow 4",
                Name        = "Tow 4"
            });

            towList.Add(new Model.TypeOfWork
            {
                Id          = 5,
                ChannelId   = 2,
                FiscalYear  = 2016,
                Description = "Tow 5",
                Name        = "Tow 5"
            });

            towList.Add(new Model.TypeOfWork
            {
                Id          = 6,
                ChannelId   = 3,
                FiscalYear  = 2016,
                Description = "Tow 6",
                Name        = "Tow 6"
            });

            towList.Add(new Model.TypeOfWork
            {
                Id          = 8,
                ChannelId   = 3,
                FiscalYear  = 0,
                Description = "Tow 8",
                Name        = "Tow 8"
            });

            #endregion

            #region  Mock

            mocktypeOfWorkRepository.Setup(x => x.GetFiscalYearList(It.IsAny <bool>())).Returns(towList);

            var budgetService = new BudgetServiceMock(userChannel: mockUserChannelRepository.Object, iTypeOfWork: mocktypeOfWorkRepository.Object,
                                                      iBudgetByCategoryRollup: mockBudgetByCategoryRollupRepository.Object);

            var budgetController = new BudgetController(userService: null, loggerService: null, budgetService: budgetService,
                                                        unitOfWork: null, productService: null, deliverableService: null, deliverableServiceV2: null, propertyService: null);
            #endregion

            #region Assertions
            mockbudgetService.Verify();

            var result = budgetController.GetTowFiscalYearList(mrmUserId, false, networkLogin);
            Assert.IsTrue(result.Count() == 3);
            Assert.IsFalse(result.Contains(new SelectListItem {
                Text = "0", Value = "0"
            }));

            #endregion
        }