Ejemplo n.º 1
0
        public static string getNextNumber(TaxDataContext contextDB)
        {
            if (AvailableNumbers.Count() > 0)
            {
                return(AvailableNumbers.Pop());
            }

            //Get current People in DB, sorted by Number, pads the Number with 0's to make sure they are the same length when sorted
            Corporate[] corporateList = contextDB.Corporate.OrderBy(m => m.Number.PadLeft(contextDB.Corporate.Count(), '0')).ToArray();

            //Gets the last number that was used, doesn't check for missing numbers that were deleted by user
            string currentNumber = corporateList[(corporateList.Length - 1)].Number;

            //Increment the last Number entered by 1
            int lastNumber;

            Int32.TryParse(currentNumber, out lastNumber);
            lastNumber++;

            //updating the LastNumber, don't know why
            Corporate.LastNumber = lastNumber.ToString();

            //return next number
            return(lastNumber.ToString());
        }
        public async Task TestGetCountryTaxes()
        {
            TaxDataContext taxeDataContext = new TaxDataContext(_connectionString);

            var taxes = await taxeDataContext.GetTaxes("UK");

            Assert.AreEqual(taxes.Count, 1);
        }
Ejemplo n.º 3
0
        public GLDocumentGAFRecordsCreatorTests()
        {
            _glDocumentGAFRecordsCreator = new GLDocumentGAFRecordsCreator(GAFRepository,
                                                                           new GafRecordBuilderByGLTranAndTaxTran(GAFRepository));

            _taxRevDataContext = GetService <TaxRevDataContext>();
            _taxDataContext    = GetService <TaxDataContext>();
        }
Ejemplo n.º 4
0
        public async Task CreateOrderTest_AU()
        {
            // Arrange
            TaxDataContext   countryTaxDataContext = new TaxDataContext(_connectionString);
            OrderDataContext orderDataContext      = new OrderDataContext(_connectionString);

            ITaxRepository   taxRepository   = new TaxRepository(countryTaxDataContext);
            IOrderRepository orderRepository = new OrderRepository(orderDataContext);

            ITaxCalculator           taxCalculator    = new TaxCalculator(taxRepository);
            IOrderCalculationService orderCalculation = new OrderCalculationService(taxCalculator);

            IOrderService orderService = new OrderService(orderRepository, orderCalculation);

            var date       = DateTime.Now;
            var orderIdStr = date.Hour.ToString() + date.Minute.ToString() + date.Second.ToString() + date.Millisecond.ToString();
            int orderIdUK  = int.Parse(orderIdStr);


            var orderUK = new Order();

            orderUK.Id       = orderIdUK;
            orderUK.Customer = new Customer()
            {
                Id      = 1,
                Country = "AU"
            };

            orderUK.Items = new List <orderItem>()
            {
                new orderItem()
                {
                    Code        = "D",
                    Description = "Product D",
                    Price       = 10,
                    Quantity    = 1
                },
                new orderItem()
                {
                    Code        = "E",
                    Description = "Product E",
                    Price       = 20,
                    Quantity    = 1
                }
            };

            //Act
            orderService.CreateOrder(orderUK);
            var singleOrderUk = await orderService.ViewOrderAsyn(orderUK.Id);

            //Assert
            Assert.AreEqual(33, singleOrderUk.Total);
        }
Ejemplo n.º 5
0
        public GAFTestsBase()
        {
            TaxDataContext     = GetService <TaxDataContext>();
            CompanyDataContext = GetService <CompanyDataContext>();

            GAFRepositoryMock = new Mock <TestGAFRepository>(GetService <TaxDataContext>(),
                                                             GetService <VendorDataContext>(),
                                                             GetService <LocationDataContext>(),
                                                             GetService <ContactDataContext>(),
                                                             GetService <CompanyDataContext>(),
                                                             GetService <CustomerDataContext>(),
                                                             GetService <ARAddressDataContext>(),
                                                             GetService <CountryDataContext>(),
                                                             GetService <SOAddressDataContext>())
            {
                CallBase = true
            };
        }
Ejemplo n.º 6
0
 public TestGAFRepository(TaxDataContext taxDataContext,
                          VendorDataContext vendorDataContext,
                          LocationDataContext locationDataContext,
                          ContactDataContext contactDataContext,
                          CompanyDataContext companyDataContext,
                          CustomerDataContext customerDataContext,
                          ARAddressDataContext arAddressDataContext,
                          CountryDataContext countryDataContext,
                          SOAddressDataContext soAddressDataContext)
 {
     _taxDataContext       = taxDataContext;
     _vendorDataContext    = vendorDataContext;
     _locationDataContext  = locationDataContext;
     _contactDataContext   = contactDataContext;
     _companyDataContext   = companyDataContext;
     _customerDataContext  = customerDataContext;
     _arAddressDataContext = arAddressDataContext;
     _countryDataContext   = countryDataContext;
     _soAddressDataContext = soAddressDataContext;
 }
Ejemplo n.º 7
0
 public TaxService(TaxDataContext context)
 {
     _context = context;
 }
 public CorporatesController(TaxDataContext context)
 {
     _contextDB = context;
 }
Ejemplo n.º 9
0
 public TaxController(TaxDataContext context, IFileService fileService)
 {
     _fileService           = fileService;
     _taxService            = new TaxService(context);
     _taxComputationService = new TaxComputationService(_taxService);
 }
Ejemplo n.º 10
0
 public TaxRepository(TaxDataContext countryTaxDataContext)
 {
     this.countryTaxDataContext = countryTaxDataContext;
 }
Ejemplo n.º 11
0
 public ExcelHolder(TaxDataContext c)
 {
     _contextDB = c;
 }
Ejemplo n.º 12
0
 public PeopleController(TaxDataContext context)
 {
     _contextDB = context;
 }
Ejemplo n.º 13
0
 public HomeController(TaxDataContext context)
 {
     _contextDB = context;
 }