public TaxControllerUnitTests() { _mockLogger = new Mock <ILogger <TaxController> >(); // this is just a test _mockTaxService = new Mock <ITaxService>(); _controller = new TaxController(_mockLogger.Object, _mockTaxService.Object); }
public TaxLogic(ITaxDataAccess taxDataAccess) { TaxEventHandler taxEventHandler; Key key; _taxDataAccess = taxDataAccess; _taxController = new TaxController <Key, TaxEventHandler>(); //set up tax handlers taxEventHandler = new ProgressiveTaxEvent(_taxDataAccess); key = new Key { TaxCode = "7441" }; _taxController.AddEventHandler(key, taxEventHandler); taxEventHandler = new FlatValueTaxEvent(_taxDataAccess); key = new Key { TaxCode = "A100" }; _taxController.AddEventHandler(key, taxEventHandler); taxEventHandler = new FlatRateTaxEvent(_taxDataAccess); key = new Key { TaxCode = "7000" }; _taxController.AddEventHandler(key, taxEventHandler); taxEventHandler = new ProgressiveTaxEvent(_taxDataAccess); key = new Key { TaxCode = "1000" }; _taxController.AddEventHandler(key, taxEventHandler); }
public ProductComponent() { InitializeComponent(); productController = new ProductController(); productTaxController = new ProductTaxController(); taxController = new TaxController(); Bind(); }
public void TestInitialize() { _mockTaxService = _mockRepository.Create <ITaxService>(); _mockTaxCalculatorService = _mockRepository.Create <ITaxCalculatorService>(); _mockTaxInputUtility = _mockRepository.Create <ITaxInputUtility>(); _taxController = new TaxController(_mockTaxService.Object, _mockTaxCalculatorService.Object, _mockTaxInputUtility.Object); }
public ProductTaxForm(Product product, ProductComponent productComponent) { InitializeComponent(); _product = product; productTaxController = new ProductTaxController(); taxController = new TaxController(); _productComponent = productComponent; }
public void SetUp() { var mockTaxCalculationRepository = new MockTaxCalculationRepository(); var taxCalculatorFactory = new TaxCalculatorFactory(mockTaxCalculationRepository); var taxCalculationWorkflow = new TaxCalculationWorkflow(mockTaxCalculationRepository, taxCalculatorFactory); _taxController = new TaxController(taxCalculationWorkflow); }
public virtual void Init() { taxController = FindObjectOfType <TaxController>(); tileController = FindObjectOfType <TileController>(); cityhallController = FindObjectOfType <CityhallController>(); SetNeedCost(); SetLock(); activeOn = ItemManager.Ins.GetItemOnData(itemState); }
public void Test3() { Taxsation.Data.models.DBContext dbContext = new Taxsation.Data.models.DBContext(); var controller = new TaxController(null, dbContext); var retval = controller.CalculateTax("test7000", 50000); decimal tax = (decimal)((Microsoft.AspNetCore.Mvc.OkObjectResult)retval).Value; Assert.AreEqual(8750, tax); Assert.Pass(); }
//Image image; // Start is called before the first frame update private new void Start() { base.Start(); Button_Event += Show_Me_The_Money; tax = FindObjectOfType <TaxController>(); //image = transform.Find("Image").GetComponent<Image>(); StartCoroutine(Company_Light_Check()); kind = Building_Type.Company; }
public async Task GetTax_ValidData_ReturnsViewResults() { // TODO try to stub all dependencies inside GetTax Action inside Tax Controller :) var userManger = Substitute.For <UserManager <ApplicationUser> >(Substitute.For <IUserStore <ApplicationUser> >(), null, null, null, null, null, null, null, null); var logger = Substitute.For <ILogger <TaxController> >(); var userTaxRepo = Substitute.For <IUserTaxRepository>(); var taxService = Substitute.For <ITaxService>(); var taxController = new TaxController(userManger, logger, userTaxRepo, taxService); var result = Assert.ThrowsAsync <ApplicationException>(() => taxController.GetTax(null)); Assert.Equal("Year must be provided", result.Result.Message); Assert.IsNotType <LocalRedirectResult>(result); Assert.IsNotType <ViewResult>(result); }
public void Taxes() { var fakerepo = new FakeFinanceRepo(); var controller = new TaxController(fakerepo); var user = new UserModel() { Name = "mindy", }; var taxes = new TaxModel() { User = user, Month = "December", MonthlyIncome = 4000.00, MonthlyQuestion = "y", }; //Act controller.Tax(taxes); var user2 = new UserModel() { Name = "Lydia", }; var taxes2 = new TaxModel() { User = user2, Month = "March", MonthlyIncome = 2000.00, MonthlyQuestion = "y", }; //Act controller.Tax(taxes2); /*select * from Posts where title= "Love this site"*/ //var query = from e in fakerepo.Posts // where e.Title == "Love this site" // select e; this is how you access data using linq from a database. var fetchPost = fakerepo.GetFinanceByName("mindy"); //Ensure that the review was added to the repository Assert.True(taxes.User.Name == fetchPost.User.Name); Assert.True(taxes.Month == fetchPost.Month); Assert.True(taxes.MonthlyIncome == fetchPost.MonthlyIncome); Assert.True(taxes.MonthlyQuestion == fetchPost.MonthlyQuestion); }
public async Task AddTax_InvalidInput_ReturnsToSameActionWithValidation() { // why all these nulls !! var userManagerStub = Substitute.For <UserManager <ApplicationUser> >(Substitute.For <IUserStore <ApplicationUser> >(), null, null, null, null, null, null, null, null); var logger = Substitute.For <ILogger <TaxController> >(); var userTaxRepo = Substitute.For <IUserTaxRepository>(); var taxService = Substitute.For <ITaxService>(); var taxController = new TaxController(userManagerStub, logger, userTaxRepo, taxService); taxController.ModelState.AddModelError("error", "error"); var result = await taxController.AddTax(new TaxViewModel()); Assert.False(taxController.ModelState.IsValid); Assert.IsType <ViewResult>(result); Assert.IsNotType <LocalRedirectResult>(result); }
public async Task GetTax_ValidData_ReturnsViewResults() { // TODO try to stub all dependencies inside GetTax Action inside Tax Controller :) var userManagerStub = Substitute.For <UserManager <ApplicationUser> >(Substitute.For <IUserStore <ApplicationUser> >(), null, null, null, null, null, null, null, null); var logger = Substitute.For <ILogger <TaxController> >(); var userTaxRepo = Substitute.For <IUserTaxRepository>(); var taxService = Substitute.For <ITaxService>(); var taxController = new TaxController(userManagerStub, logger, userTaxRepo, taxService); var claimsPrincipal = Substitute.For <ClaimsPrincipal>(); ApplicationUser user = new ApplicationUser { UserName = "******", Id = Guid.NewGuid().ToString(), Email = "*****@*****.**" }; _ = userManagerStub.GetUserAsync(claimsPrincipal).Returns(user); const int year = 2000; var userTax = new UserTax { CharityPaidAmount = 10, NumberOfChildren = 0, TaxDueAmount = 10, TotalIncome = 3000, Year = 2000 }; _ = userTaxRepo.GetUserTax(user.Id, year).Returns(userTax); //var taxViewResult = new TaxViewModel //{ // CharityPaidAmount = userTax.CharityPaidAmount, // NumberOfChildren = userTax.NumberOfChildren, // TotalIncome = userTax.TotalIncome, // Year = userTax.Year, // TaxDueAmount = userTax.TaxDueAmount //}; //I think we don't need to use taxViewResult and i want to know diff btn .Received() and .Returns() var result = await taxController.GetTax(year); Assert.IsType <ViewResult>(result); }
public async Task GetTax_ValidData_ReturnsViewResults() { int year = 2000; string userId = "userid"; var userManagerStub = new Mock <UserManager <ApplicationUser> >(new Mock <IUserStore <ApplicationUser> >().Object, null, null, null, null, null, null, null, null); var logger = new Mock <ILogger <TaxController> >(); var userTaxRepo = new Mock <IUserTaxRepository>(); var taxService = new Mock <ITaxService>(); userManagerStub.Setup(x => x.GetUserAsync(null)).ReturnsAsync(new ApplicationUser { Id = userId }); userTaxRepo.Setup(x => x.GetUserTax(userId, year)).Returns(Task.FromResult(new UserTax { UserId = userId, Year = year, NumberOfChildren = 1, TaxDueAmount = 10, TotalIncome = 6000, CharityPaidAmount = 10 })); TaxController taxController = new TaxController(userManagerStub.Object, logger.Object, userTaxRepo.Object, taxService.Object); var result = await taxController.GetTax(year); Assert.IsAssignableFrom <IActionResult>(result); }
public TaxComponent() { InitializeComponent(); taxController = new TaxController(); Bind(); }
// Start is called before the first frame update void Start() { tax = FindObjectOfType <TaxController>(); }
public void Setup() { controller = new TaxController(TestEngine.GetProfiles()); }
static void Main(string[] args) { Console.WriteLine(" Main function invokded by Primary thread {0}.", Thread.CurrentThread.ManagedThreadId); ArithmaticOperqtion opn1 = new ArithmaticOperqtion(Addition); TaxController controller = ControllerFactory.CreateInstance(); // Controller action method registration TaxOperation tax1 = new TaxOperation(controller.PayIncomeTax); TaxOperation tax2 = new TaxOperation(controller.PaySalesTax); TaxOperation tax3 = new TaxOperation(controller.PayServiceTax); //perform asynchronous action methods IAsyncResult iarTax1 = tax1.BeginInvoke(null, null); IAsyncResult iarTax2 = tax2.BeginInvoke(null, null); IAsyncResult iarTax3 = tax3.BeginInvoke(null, null); //Perform other tasks independent of //taxation using primary Thread //Listen for incomming requests from client while (!iarTax1.AsyncWaitHandle.WaitOne(1000, true)) { Console.WriteLine(".....Get other customer details!"); Console.WriteLine("Primary thread {0}.", Thread.CurrentThread.ManagedThreadId); } while (!iarTax2.AsyncWaitHandle.WaitOne(1000, true)) { Console.WriteLine(".....Get other customer details!"); Console.WriteLine("Primary thread {0}.", Thread.CurrentThread.ManagedThreadId); } while (!iarTax3.AsyncWaitHandle.WaitOne(1000, true)) { Console.WriteLine(".....Get other customer details!"); Console.WriteLine("Primary thread {0}.", Thread.CurrentThread.ManagedThreadId); } tax1.EndInvoke(iarTax1); tax2.EndInvoke(iarTax2); tax3.EndInvoke(iarTax3); Console.WriteLine(" primary thread recieved notification"); Console.WriteLine(" primary thread now started other work after taxation"); /* * int op1 = 45; * int op2 = 3; * * // int result = opn1(op1, op2); * IAsyncResult iftAR= opn1.BeginInvoke(op1, op2, null, null); * * // This message will keep printing until the Add() method is finished. * while (!iftAR.AsyncWaitHandle.WaitOne(1000, true)) * { * Console.WriteLine("Doing more work in Main()!"); * Console.WriteLine("Primary thread {0}.", Thread.CurrentThread.ManagedThreadId); * } * * int result = opn1.EndInvoke(iftAR); * Console.WriteLine(" Result = {0}", result); * Console.WriteLine(result); */ Console.ReadLine(); }
public void Init() { this._fakeService = new FakeTaxService(); this._taxController = new TaxController(_fakeService); }
public TaxControllerTests() { _logger = new Mock <ILogger <TaxController> >(); _taxProvider = new Mock <ITaxProvider>(); _taxController = new TaxController(_logger.Object, _taxProvider.Object); }
public static void Main(string[] args) { int pilih; do { Console.Clear(); Console.WriteLine("=======MENU======="); Console.WriteLine("1. Employee"); Console.WriteLine("2. Data Overtime"); Console.WriteLine("3. Department"); Console.WriteLine("4. Role"); Console.WriteLine("5. Customer"); Console.WriteLine("6. Tax"); Console.WriteLine("7. Tipe Overtime"); Console.WriteLine("8. Exit"); Console.WriteLine("=================="); Console.Write("Pilih Action : "); pilih = Convert.ToInt32(System.Console.ReadLine()); switch (pilih) { case 1: EmployeeController callEmp = new EmployeeController(); callEmp.Menu(); break; case 2: DataOvertimeController callDOV = new DataOvertimeController(); callDOV.Menu(); break; case 3: DepartmentController callDept = new DepartmentController(); callDept.Menu(); break; case 4: RoleController callRole = new RoleController(); callRole.Menu(); break; case 5: CustomerController callCust = new CustomerController(); callCust.Menu(); break; case 6: TaxController callTax = new TaxController(); callTax.Menu(); break; case 7: TypeOvertimeController callType = new TypeOvertimeController(); break; default: System.Console.Write("Exit Cuy!"); System.Console.Read(); break; } } while (pilih != 2); }
public TaxManagementTests() { mockMediator = new Mock <IMediator>(); mockLogger = new Mock <ILogger <TaxController> >(); taxController = new TaxController(mockLogger.Object, mockMediator.Object); }