Пример #1
0
        public void BillShouldBeReturnedWhenAccountExists()
        {
            // ARRANGE
            const long accountId = 123;

            var             billingService = A.Fake <IBillingService>();
            IBillRepository billRepository = new BillRepository(billingService);

            A.CallTo(() => billingService.GetBill(accountId)).Returns(SampleBill);

            var sut = BillController(billRepository);

            // ACT
            var response = sut.Breakdown(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);

            BillBreakdown billModel;

            response.TryGetContentValue(out billModel);

            Assert.NotNull(billModel);
            Assert.Equal(28, billModel.CallCharges.Calls.Length);
        }
        public companyWindow(CompanyRepository companyRepository, BillRepository billRepository, BillManager billManager)
        {
            this.companyRepository = companyRepository;
            this.billRepository = billRepository;
            this.billManager = billManager;

            CompanyWindowViewModel = new InformationWindowViewModel<Company>();
            CompanyWindowViewModel.Items = new ObservableCollection<Company>(companyRepository.All.ToList());

            InitializeComponent();

            DataContext = this;

            controller = new InformationWindowController<Company>(CompanyWindowViewModel, companies_ComboBox,
                new TextBox[]
            {
                companyName_TextBox,
                companyStreet_TextBox,
                companyCity_TextBox,
                companyPostalCode_TextBox,
                companyID_TextBox,
                companyAccountNumber_TextBox,
                companyBankName_TextBox,
                companyBankBIC_TextBox,
                companyBillerName_TextBox,
                companyPhoneNumber_TextBox,
                companyEmailAddress_TextBox
            });
        }
Пример #3
0
        public void StatusCode404ShouldBeReturnedWhenNoAccountExists()
        {
            // ARRANGE
            const long accountId = 456;

            var             billingService = A.Fake <IBillingService>();
            IBillRepository billRepository = new BillRepository(billingService);

            A.CallTo(() => billingService.GetBill(accountId)).Returns("");

            var sut = BillController(billRepository);

            // ACT
            var response = sut.Breakdown(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);

            BillBreakdown billModel;

            response.TryGetContentValue(out billModel);

            Assert.Null(billModel);
        }
Пример #4
0
        public void AccountSummaryShouldBeReturnedWhenAccountExists()
        {
            // ARRANGE
            const long accountId = 123;

            var billingService = A.Fake<IBillingService>();
            IBillRepository billRepository = new BillRepository(billingService);

            A.CallTo(() => billingService.GetBill(accountId)).Returns(SampleBill);

            var sut = BillController(billRepository);

            // ACT
            var response = sut.Summary(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);

            BillSummary accountSummaryModel;
            response.TryGetContentValue(out accountSummaryModel);

            Assert.NotNull(accountSummaryModel);
            Assert.Equal(136.03m, accountSummaryModel.Total);
            Assert.Equal(71.40m, accountSummaryModel.PackageTotal);
            Assert.Equal(24.97m, accountSummaryModel.SkyStoreTotal);
            Assert.Equal(59.64m, accountSummaryModel.CallChargesTotal);
            Assert.Equal(new DateTime(2015, 1, 26), accountSummaryModel.From);
            Assert.Equal(new DateTime(2015, 2, 25), accountSummaryModel.To);
        }
Пример #5
0
        public void TestInitialize()
        {
            _context = new DbTestContext(Settings.Default.MainConnectionString);
            _fixture = new Fixture();

            _repository = new BillRepository(new SqlProcedureExecutor(Settings.Default.MainConnectionString));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int Qid     = Convert.ToInt32(lblOrderID.Text);
            var myOrder = db.Orders.FirstOrDefault(x => x.OrderID == Qid);

            myOrder.PaymentStatusID = 1;
            myOrder.FoodStatusID    = 1;
            db.SaveChanges();

            //////////////////////////////////////////////////////////////////////
            OrderDetail od        = new OrderDetail();
            int         productid = Convert.ToInt32(lblpid.Text);
            var         myProduct = db.Products.FirstOrDefault(x => x.ProductID == productid);

            od.OrderID   = Qid;
            od.ProductID = Convert.ToInt32(lblpid.Text);
            decimal price = Convert.ToDecimal(myProduct.ProductPrice * numericUpDown1.Value);

            od.Price = price;
            OrderDetailRepository odr = new OrderDetailRepository();

            odr.Add(od);


            Bill bill = new Bill();

            bill.CustomerID = myOrder.CustomerID;
            bill.OrderID    = myOrder.OrderID;
            bill.BillAmount = price;
            bill.CreatorID  = myOrder.CreatorID;
            BillRepository br = new BillRepository();

            br.Add(bill);
        }
        public async Task InsertAsync()
        {
            // Arrange
            BillRepository billRepository = new BillRepository();

            billRepository.SetDbContext(testContext);

            int expectedEntitiesBeforeInsertCount = TestData.BillsCount;
            int expectedEntitiesAfterInsertCount  = TestData.BillsCount + 1;

            Bill entityToInsert = new Bill {
                Id = 100, PaymentStatus = Enums.PaymentStatus.WaitingForPayment
            };

            // Act
            int actualEntitiesBeforeInsertCount = testContext.Bills.Count();
            await billRepository.InsertAsync(entityToInsert);

            testContext.SaveChanges();
            int actualEntitiesAfterInsertCount = testContext.Bills.Count();

            // Assert
            Assert.Equal(expectedEntitiesBeforeInsertCount, actualEntitiesBeforeInsertCount);
            Assert.Equal(expectedEntitiesAfterInsertCount, actualEntitiesAfterInsertCount);
            Assert.Contains(entityToInsert, testContext.Bills);
        }
        public void CountTest()
        {
            // Arrange
            BillRepository billRepository = new BillRepository();

            billRepository.SetDbContext(testContext);

            int expectedBillsCount                  = TestData.BillsCount;
            int expectedPaidBillsCount              = TestData.PaidBillsCount;
            int expectedPaidWithDelayBillsCount     = TestData.PaidWithDelayBillsCount;
            int expectedWaitingForPaymentBillsCount = TestData.WaitingForPaymentBillsCount;
            int expectedOverdueBillsCount           = TestData.OverdueBillsCount;

            // Act
            int actualBillsCount                  = billRepository.Count();
            int actualPaidBillsCount              = billRepository.Count(b => b.PaymentStatus == Enums.PaymentStatus.Paid);
            int actualPaidWithDelayBillsCount     = billRepository.Count(b => b.PaymentStatus == Enums.PaymentStatus.PaidWithDelay);
            int actualWaitingForPaymentBillsCount = billRepository.Count(b => b.PaymentStatus == Enums.PaymentStatus.WaitingForPayment);
            int actualOverdueBillsCount           = billRepository.Count(b => b.PaymentStatus == Enums.PaymentStatus.Overdue);

            // Assert
            Assert.Equal(expectedBillsCount, actualBillsCount);
            Assert.Equal(expectedPaidBillsCount, actualPaidBillsCount);
            Assert.Equal(expectedPaidWithDelayBillsCount, actualPaidWithDelayBillsCount);
            Assert.Equal(expectedWaitingForPaymentBillsCount, actualWaitingForPaymentBillsCount);
            Assert.Equal(expectedOverdueBillsCount, actualOverdueBillsCount);
        }
Пример #9
0
        //
        // GET: /bill/show/345

        public ActionResult Show(int id)
        {
            BillRepository db   = new BillRepository();
            Bill           bill = db.GetById(id);

            return(View(bill));
        }
        public void DeleteByIdTest()
        {
            // Arrange
            BillRepository billRepository = new BillRepository();

            billRepository.SetDbContext(testContext);

            Bill entityToDelete            = testContext.Bills.First();
            int  idToDelete                = entityToDelete.Id;
            int  expectedCountBeforeDelete = TestData.BillsCount;
            int  expectedCountAfterDelete  = TestData.BillsCount - 1;

            // Act
            int actualCountBeforeDelete = testContext.Bills.Count();

            billRepository.Delete(idToDelete);
            testContext.SaveChanges();
            int actualCountAfterDelete = testContext.Bills.Count();

            // Assert
            Assert.Equal(expectedCountBeforeDelete, actualCountBeforeDelete);
            Assert.Equal(expectedCountAfterDelete, actualCountAfterDelete);
            Assert.DoesNotContain(testContext.Users, x => x.Id == idToDelete);
            Assert.DoesNotContain(entityToDelete, testContext.Bills);
        }
Пример #11
0
 public BillService(AccountRepository accountRepository, BillRepository billRepository, IMapper mapper, AbstractValidator <BillDTO> validator)
 {
     this.accountRepository = accountRepository;
     this.billRepository    = billRepository;
     this.mapper            = mapper;
     this.validator         = validator;
 }
        public void GetAll()
        {
            var itemrepo = new BillRepository(itemcontextmock.Object);
            var itemlist = itemrepo.Getbill(1230);

            Assert.NotNull(itemlist);
        }
Пример #13
0
        public void BillShouldBeReturnedWhenAccountExists()
        {
            // ARRANGE
            const long accountId = 123;

            var billingService = A.Fake<IBillingService>();
            IBillRepository billRepository = new BillRepository(billingService);

            A.CallTo(() => billingService.GetBill(accountId)).Returns(SampleBill);

            var sut = BillController(billRepository);

            // ACT
            var response = sut.Breakdown(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);

            BillBreakdown billModel;
            response.TryGetContentValue(out billModel);

            Assert.NotNull(billModel);
            Assert.Equal(28, billModel.CallCharges.Calls.Length);
        }
Пример #14
0
        public void StatusCode404ShouldBeReturnedWhenNoAccountExists()
        {
            // ARRANGE
            const long accountId = 456;

            var billingService = A.Fake<IBillingService>();
            IBillRepository billRepository = new BillRepository(billingService);

            A.CallTo(() => billingService.GetBill(accountId)).Returns("");

            var sut = BillController(billRepository);

            // ACT
            var response = sut.Breakdown(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);

            BillBreakdown billModel;
            response.TryGetContentValue(out billModel);

            Assert.Null(billModel);
        }
Пример #15
0
        public void StatusCode500ShouldBeReturnedWhenAnExceptionOccurs()
        {
            // ARRANGE
            const long accountId = 999;

            var billingService = A.Fake <IBillingService>();

            A.CallTo(() => billingService.GetBill(A <long> ._)).Throws <Exception>();

            IBillRepository billRepository = new BillRepository(billingService);

            //var sut = AccountController(BillRepository);
            var sut = new BillController(billRepository)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };

            // ACT
            var response = sut.Summary(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);

            BillSummary accountSummaryModel;

            response.TryGetContentValue(out accountSummaryModel);

            Assert.Null(accountSummaryModel);
        }
Пример #16
0
        public void AccountSummaryShouldBeReturnedWhenAccountExists()
        {
            // ARRANGE
            const long accountId = 123;

            var             billingService = A.Fake <IBillingService>();
            IBillRepository billRepository = new BillRepository(billingService);

            A.CallTo(() => billingService.GetBill(accountId)).Returns(SampleBill);

            var sut = BillController(billRepository);

            // ACT
            var response = sut.Summary(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);

            BillSummary accountSummaryModel;

            response.TryGetContentValue(out accountSummaryModel);

            Assert.NotNull(accountSummaryModel);
            Assert.Equal(136.03m, accountSummaryModel.Total);
            Assert.Equal(71.40m, accountSummaryModel.PackageTotal);
            Assert.Equal(24.97m, accountSummaryModel.SkyStoreTotal);
            Assert.Equal(59.64m, accountSummaryModel.CallChargesTotal);
            Assert.Equal(new DateTime(2015, 1, 26), accountSummaryModel.From);
            Assert.Equal(new DateTime(2015, 2, 25), accountSummaryModel.To);
        }
Пример #17
0
        public ActionResult ConfirmDecision(String decision, String Department, Int64 id)
        {
            ApricotContext Db = new ApricotContext();

            BillRepository billrepo = new BillRepository(Db);
            Bill           bill     = billrepo.GetByBillID(id);

            if (decision == "yes")
            {
                bill.Bill_Status = Data.Models.ApricotEnums.BillSatusEnum.APPROVED;
                billrepo.UpdateBill(bill);

                FinanceManagerBL fmbl = new FinanceManagerBL(Db);
                fmbl.AlloteFinanceManager(id, Department);

                NotificationBL notibl = new NotificationBL(Db);
                notibl.NotificationOfApproval(id);
            }

            else if (decision == "no")
            {
                bill.Bill_Status = Data.Models.ApricotEnums.BillSatusEnum.REJECTED;
                billrepo.UpdateBill(bill);

                NotificationBL notibl = new NotificationBL(Db);
                notibl.NotificationOfRejection(bill.Bill_ID);
            }

            return(RedirectToAction("Index", "Manager"));
        }
Пример #18
0
        public void StatusCode500ShouldBeReturnedWhenAnExceptionOccurs()
        {
            // ARRANGE
            const long accountId = 999;

            var billingService = A.Fake<IBillingService>();
            A.CallTo(() => billingService.GetBill(A<long>._)).Throws<Exception>();

            IBillRepository billRepository = new BillRepository(billingService);

            //var sut = AccountController(BillRepository);
            var sut = new BillController(billRepository)
            {
                Request = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };

            // ACT
            var response = sut.Summary(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);

            BillSummary accountSummaryModel;
            response.TryGetContentValue(out accountSummaryModel);

            Assert.Null(accountSummaryModel);
        }
Пример #19
0
        public void StatusCode500ShouldBeReturnedWhenAnExceptionOccurs()
        {
            // ARRANGE
            const long accountId = 999;

            var billingService = A.Fake <IBillingService>();

            A.CallTo(() => billingService.GetBill(A <long> ._)).Throws <Exception>();

            IBillRepository billRepository = new BillRepository(billingService);
            var             sut            = BillController(billRepository);

            // ACT
            var response = sut.Breakdown(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);

            BillBreakdown billModel;

            response.TryGetContentValue(out billModel);

            Assert.Null(billModel);
        }
Пример #20
0
        public void AddNewBill(string inCode, int inAmount, DateTime inTime, Event inEvent)
        {
            BillRepository.getInstance().addBill(new Bill(inCode, inAmount, inTime, inEvent));

            List <Bill> list = GetBillList();

            //NotifyObservers(list);
        }
        private bool SaveBilltoDb(IEnumerable <BillModel> billsToSave)
        {
            var repo           = new BillRepository();
            var convertedBills = ConvertProgramToDb.ConvertBill(billsToSave);

            repo.AddBill(convertedBills);
            return(true);
        }
Пример #22
0
 public BillService(ApplicationDbContext context, IConfiguration config, IHttpContextAccessor httpContextAccessor) : base(context, config, httpContextAccessor)
 {
     _billRepository = new BillRepository(context, UserName);
     _accountService = new AccountService(context, config, httpContextAccessor);
     _expenseService = new ExpenseService(context, config, httpContextAccessor);
     _context        = context;
     _configuration  = config;
 }
        private bool SaveBilltoDb(BillModel billToSave)
        {
            var repo          = new BillRepository();
            var convertedBill = ConvertProgramToDb.ConvertBill(billToSave);

            repo.AddBill(convertedBill);
            return(true);
        }
        public void CreateNewBill(string username, BillViewModel model)
        {
            //get Employee
            EmployeeRepository employeerepo = new EmployeeRepository(_context);
            var employee = employeerepo.GetByEmpNo(username);
            var empId    = employee.Emp_ID;

            //Create Bill
            BillRepository billrepo = new BillRepository(_context);
            Bill           bill     = new Bill();

            bill.Bill_Status = model.BillStatus;
            bill.Emp_ID      = empId;

            billrepo.AddBill(bill);

            //Create Bill Details
            BillDetailRepository billdetailrepo = new BillDetailRepository(_context);
            Bill_Detail          billdetail     = new Bill_Detail()
            {
                Bill_Amount        = model.BillAmount,
                Bill_Date          = model.BillDate,
                Bill_ModeOfPayment = model.ModeOfPayment,
                Bill_Type          = model.BillType,
                Bill_ID            = bill.Bill_ID,
                Bill_have_SCopy    = (model.BillSCopy != null) ? true : false,
            };

            billdetailrepo.AddBillDetail(billdetail);

            //Add Scanned Copy
            if (billdetail.Bill_have_SCopy)
            {
                BillSCopyRepository bscopyrepo = new BillSCopyRepository(_context);
                Bill_SCopy          billscopy  = new Bill_SCopy()
                {
                    Bill_ID = bill.Bill_ID,
                    SCopy   = model.BillSCopy
                };
                bscopyrepo.AddBillSCopy(billscopy);
            }

            //Add Bill Manager
            //get Manager's EmpID

            String[] emp_no_name = model.Manager.Split('-');
            var      ManagerId   = employeerepo.GetByEmpNo(emp_no_name[0]).Emp_ID;

            BillMRepository bmrepo = new BillMRepository(_context);

            Bill_M billm = new Bill_M();

            billm.Bill_ID = bill.Bill_ID;
            billm.Emp_ID  = ManagerId;

            bmrepo.AddBillM(billm);
        }
Пример #25
0
 public OrderViewModel(MainViewModel mainViewModel)
 {
     CurrentViewModel       = new GroupItemsViewModel(this);
     _mainViewModel         = mainViewModel;
     _orderDetailRepository = new OrderDetailRepository(_connectionString);
     _orderRepository       = new OrderRepository(_connectionString);
     _tableRepository       = new TableRepository(_connectionString);
     _billRepositary        = new BillRepository(_connectionString);
 }
Пример #26
0
        public UserControl1()
        {
            InitializeComponent();

            billRepository = new BillRepository();
            billSource     = new BindingSource();

            bindSourceToDataGridView();
        }
Пример #27
0
        public Bill CreateBill(BillRequest Bill)
        {
            var entityToInsert = new Bill()
            {
            };

            MergeBill(entityToInsert, Bill);
            BillRepository.Insert(entityToInsert);
            return(entityToInsert);
        }
Пример #28
0
 public HotelRepository()
 {
     Guests                 = new GuestRepository();
     Rooms                  = new RoomRepository();
     Bills                  = new BillRepository();
     RoomServices           = new RoomServiceRepository();
     Reciepts               = new ReciptReposetory();
     Employees              = new EmployeeRepository();
     ReceptionistValidation = new EmployeeValidationRepository();
 }
Пример #29
0
 public Mapping(AccountRepository accRepo, BillRepository billRepo, GoodRepository goodRepo,
                GoodTypeRepository goodTypeRepo, ImportanceRepository impRepo, UserRepository userRepo)
 {
     this.accRepo      = accRepo;
     this.billRepo     = billRepo;
     this.goodRepo     = goodRepo;
     this.goodTypeRepo = goodTypeRepo;
     this.impRepo      = impRepo;
     this.userRepo     = userRepo;
 }
Пример #30
0
        private void RefreshBillsItems()
        {
            BillsItems.Clear();
            IOrderedEnumerable <BillItem> bills = BillRepository.GetItems()
                                                  .OrderByDescending(b => b.DateOfReading);

            foreach (BillItem bill in bills)
            {
                BillsItems.Add(bill);
            }
        }
 public ManageSubProjectCController(UsersAccessRepository usersAccessRepository,
                                    SubProjectRepository subProjectRepository,
                                    ProjectRepository projectRepository,
                                    BillRepository billRepository,
                                    KeywordsRepository keywordsRepository) : base(usersAccessRepository)
 {
     _subProjectRepository = subProjectRepository;
     _projectRepository    = projectRepository;
     _billRepository       = billRepository;
     _keywordsRepository   = keywordsRepository;
 }
Пример #32
0
        public Bill GetById(int BillId)
        {
            var Bill = BillRepository.GetById(BillId);

            if (Bill == null)
            {
                throw new BadRequestException(ErrorMessages.FacturaNoEncontrada);
            }

            return(Bill);
        }
Пример #33
0
        public List <Bill> GetBillList()
        {
            List <Bill> retList = new List <Bill>();

            for (int i = 0; i < BillRepository.getInstance().Count(); i++)
            {
                Bill refBill = BillRepository.getInstance().getBillByIndex(i);
                retList.Add(refBill);
            }

            return(retList);
        }
Пример #34
0
        public async void TestMethod1()
        {
            BillRepository repo = new BillRepository();
            IList <Bill>   bill = await repo.Read();

            foreach (Bill bi in bill)
            {
                foreach (BillDetail detail in bi.Detail)
                {
                    Assert.IsNotNull(detail.Product);
                }
            }
        }
Пример #35
0
        static void Main(string[] args)
        {
            IMongoDB service = new MongoDb();

            var BillRepository = new BillRepository(service, "Bill");

            BillRepository.CreateOrUpdate(new Bill()
            {
                Id           = 1,
                CustomerName = "Pepe",
                Total        = 232
            });
        }
Пример #36
0
        public MainWindow()
        {
            InitializeComponent();

            model = new EzBillingModel();
            clientRepository = new ClientRepository(model);
            companyRepository = new CompanyRepository(model);
            billRepository = new BillRepository(model);

            excelConnection = new ExcelConnection();
            billManager = new BillManager();

            clientWindow = new clientWindow(clientRepository, billRepository, billManager);
            companyWindow = new companyWindow(companyRepository, billRepository, billManager);

            clientWindow.Closing += new CancelEventHandler(window_Closing);
            companyWindow.Closing += new CancelEventHandler(window_Closing);

            ClientViewModel = new InformationWindowViewModel<Client>();
            ClientViewModel.Items = new ObservableCollection<Client>(clientRepository.All.ToList());

            CompanyViewModel = new InformationWindowViewModel<Company>();
            CompanyViewModel.Items = new ObservableCollection<Company>(companyRepository.All.ToList());
            CompanyViewModel.PropertyChanged += CompanyViewModel_PropertyChanged;

            ProductViewModel = new InformationWindowViewModel<Product>();
            ProductViewModel.Items = new ObservableCollection<Product>();
            ProductViewModel.PropertyChanged += ProductViewModel_PropertyChanged;

            BillViewModel = new InformationWindowViewModel<Bill>();
            BillViewModel.Items = new ObservableCollection<Bill>();
            BillViewModel.PropertyChanged += BillViewModel_PropertyChanged;

            this.Closing += MainWindow_Closing;

            productSectionInputFields = new TextBox[]
            {
                productName_TextBox,
                productQuantity_TextBox,
                productUnit_TextBox,
                productUnitPrice_TextBox,
                productVATPercent_TextBox
            };

            DataContext = this;

            excelConnection.Open();
        }
Пример #37
0
        public void Initialize(string filename)
        {
            IDatabaseFactory databaseFactory = new DatabaseFactory();
            IUnitOfWork unitOfWork = new UnitOfWork(databaseFactory);
            IAccountRepository accountRepository = new AccountRepository(databaseFactory);
            ITransactionRepository transactionRepository = new TransactionRepository(databaseFactory);
            ICategoryRepository categoryRepository = new CategoryRepository(databaseFactory);
            IVendorRepository vendorRepository = new VendorRepository(databaseFactory);
            ICategoryGroupRepository categoryGroupRepository = new CategoryGroupRepository(databaseFactory);
            IBillRepository billRepository = new BillRepository(databaseFactory);
            IBillTransactionRepository billTransactionRepository = new BillTransactionRepository(databaseFactory);
            IBillGroupRepository billGroupRepository = new BillGroupRepository(databaseFactory);
            IBudgetCategoryRepository budgetCategoryRepository = new BudgetCategoryRepository(databaseFactory);
            IAccountGroupRepository accountGroupRepository = new AccountGroupRepository(databaseFactory);
            IImportDescriptionVendorMapRepository importDescriptionVendorMapRepository = new ImportDescriptionVendorMapRepository(databaseFactory);
            IAccountService accountService = new AccountService(unitOfWork, accountRepository, transactionRepository, categoryRepository, vendorRepository, billRepository, billTransactionRepository, billGroupRepository, categoryGroupRepository, budgetCategoryRepository, importDescriptionVendorMapRepository);
            TransactionImporter importer = new TransactionImporter(unitOfWork, accountService, accountRepository, transactionRepository, vendorRepository, categoryGroupRepository, accountGroupRepository, importDescriptionVendorMapRepository);

            importer.Import(filename);
        }
Пример #38
0
        public void StatusCode500ShouldBeReturnedWhenAnExceptionOccurs()
        {
            // ARRANGE
            const long accountId = 999;

            var billingService = A.Fake<IBillingService>();
            A.CallTo(() => billingService.GetBill(A<long>._)).Throws<Exception>();

            IBillRepository billRepository = new BillRepository(billingService);
            var sut = BillController(billRepository);

            // ACT
            var response = sut.Breakdown(accountId);

            // ASSERT
            A.CallTo(() => billingService.GetBill(accountId)).MustHaveHappened();

            Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);

            BillBreakdown billModel;
            response.TryGetContentValue(out billModel);

            Assert.Null(billModel);
        }
Пример #39
0
 public BillService(BillRepository repository)
 {
     this.repository = repository;
 }