Пример #1
0
        public void GetCashflowSubCategoryById_Success_Return_OK()
        {
            //Setup
            Mock <IServiceProvider> serviceProviderMock = GetServiceProvider();
            var service = new Mock <IBudgetCashflowService>();
            var model   = new BudgetCashflowSubCategoryModel("", 1, 1, new List <int>()
            {
                1
            }, true, new ReportType(), false);

            service
            .Setup(s => s.GetBudgetCashflowSubCategoryById(It.IsAny <int>()))
            .Returns(new BudgetCashflowSubCategoryTypeDto(model));

            serviceProviderMock
            .Setup(serviceProvider => serviceProvider.GetService(typeof(IBudgetCashflowService)))
            .Returns(service.Object);

            //Act
            CashflowSubCategoryFormDto form = new CashflowSubCategoryFormDto();
            IActionResult response          = GetController(serviceProviderMock).GetCashflowSubCategoryById(1);

            //Assert
            int statusCode = this.GetStatusCode(response);

            Assert.Equal((int)HttpStatusCode.OK, statusCode);
        }
Пример #2
0
 public void SetSubCategory(BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency, bool isShowSubCategoryLabel)
 {
     CashflowSubCategory    = cashflowSubCategory;
     Currency               = currency;
     IsSubCategory          = true;
     IsShowSubCategoryLabel = isShowSubCategoryLabel;
 }
 public BudgetCashflowUnitDto(BudgetCashflowTypeModel cashflowType, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, BudgetCashflowUnitModel cashflowUnit)
 {
     CashflowType        = cashflowType;
     CashflowCategory    = cashflowCategory;
     CashflowSubCategory = cashflowSubCategory;
     CashflowUnit        = cashflowUnit;
 }
Пример #4
0
 public DivisionTemporaryDivisionUnitDto(BudgetCashflowTypeModel cashflowType, CashType type, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency, DivisionDto division)
 {
     CashflowType        = cashflowType;
     Type                = type;
     CashflowCategory    = cashflowCategory;
     CashflowSubCategory = cashflowSubCategory;
     Currency            = currency;
     Division            = division;
 }
        public BudgetCashflowItemDto(bool isShowSubCategoryLabel, BudgetCashflowSubCategoryModel subCategory, CurrencyDto currency)
        {
            IsShowSubCategoryLabel = isShowSubCategoryLabel;
            SubCategoryId          = subCategory.Id;
            SubCategoryName        = subCategory.Name;
            IsReadOnly             = subCategory.IsReadOnly;
            Currency = currency;

            Items = new List <UnitItemDto>();
        }
Пример #6
0
 public BudgetCashflowDivisionItemDto(BudgetCashflowTypeModel cashflowType, CashType type, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency, bool isShowSubCategoryLabel) : this(cashflowType, type)
 {
     CashflowType           = cashflowType;
     Type                   = type;
     TypeName               = type.ToDescriptionString();
     CashflowCategory       = cashflowCategory;
     CashflowSubCategory    = cashflowSubCategory;
     Currency               = currency;
     IsSubCategory          = true;
     IsShowSubCategoryLabel = isShowSubCategoryLabel;
     Items                  = new List <BudgetCashflowDivisionUnitItemDto>();
 }
 public BudgetCashflowSubCategoryTypeDto(BudgetCashflowSubCategoryModel model)
 {
     Id   = model.Id;
     Name = model.Name;
     PurchasingCategoryIds = JsonConvert.DeserializeObject <List <int> >(model.PurchasingCategoryIds);
     IsReadOnly            = model.IsReadOnly;
     LayoutOrder           = model.LayoutOrder;
     ReportType            = model.ReportType;
     ReportTypeName        = model.ReportType.ToDescriptionString();
     CashflowCategoryId    = model.CashflowCategoryId;
     IsImport = model.IsImport;
 }
Пример #8
0
 public DivisionTemporaryDivisionUnitDto(BudgetCashflowTypeModel cashflowType, CashType type, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency, DivisionDto division, UnitAccountingDto unitAccounting, BudgetCashflowUnitModel cashflowUnit)
 {
     CashflowType        = cashflowType;
     Type                = type;
     CashflowCategory    = cashflowCategory;
     CashflowSubCategory = cashflowSubCategory;
     Currency            = currency;
     Division            = division;
     Unit                = new UnitDto {
         Code       = unitAccounting.Code,
         DivisionId = unitAccounting.DivisionId,
         Id         = unitAccounting.Id,
         Name       = unitAccounting.Name
     };
     CashflowUnit = cashflowUnit;
 }
        public BudgetCashflowMasterDto(BudgetCashflowTypeModel cashflowType, BudgetCashflowCategoryModel cashflowTypeWithCategory, BudgetCashflowSubCategoryModel cashflowCategoryWithSubCategory)
        {
            CashflowType            = cashflowType.Name;
            CashflowTypeId          = cashflowType.Id;
            CashflowTypeLayoutOrder = cashflowType.LayoutOrder;


            if (cashflowTypeWithCategory != null)
            {
                CashflowCategoryId          = cashflowTypeWithCategory.Id;
                CashType                    = cashflowTypeWithCategory.Type.ToDescriptionString();
                CashflowCategory            = cashflowTypeWithCategory.Name;
                CashflowCategoryLayoutOrder = cashflowTypeWithCategory.LayoutOrder;
            }

            if (cashflowCategoryWithSubCategory != null)
            {
                CashflowSubCategoryId          = cashflowCategoryWithSubCategory.Id;
                CashflowSubCategory            = cashflowCategoryWithSubCategory.Name;
                CashflowSubCategoryLayoutOrder = cashflowCategoryWithSubCategory.LayoutOrder;
            }
        }
 public DivisionTemporaryRowDto(BudgetCashflowTypeModel cashflowType, CashType type, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency) : this(cashflowType, type, cashflowCategory)
 {
     Currency            = currency;
     CashflowSubCategory = cashflowSubCategory;
 }