Example #1
0
        public async void VerifyingActionStart()
        {
            TestDbContext context = new TestDbContext();
            EmployeesController employeecontroller = new EmployeesController(context, null);
            Workman workman = new Workman
            {
                FirstName = "Fworkername",
                LastName = "Lworkername",
                Position = "SomeJobs",
                Status = true,
                Tasso = 100000,
                TaxRate = 25,
                Tax = 25000,
                Wages = 75000
            };
            context.Workmen.Add(workman);
            context.Workmen.Add(workman);
            context.Workmen.Add(workman);
            await context.SaveChangesAsync();

            var result = (ViewResult)employeecontroller.Start().Result;
            ComplexModel compModel = (ComplexModel)result.ViewData.Model;

            Assert.NotEmpty(compModel.Workmen);
            Assert.Equal<int>(compModel.CurrentPage, 0);
            Assert.True(compModel.Status == null);
            Assert.Equal<decimal>(compModel.Workmen.FirstOrDefault().Wages, 75000);

            context.Dispose();
        }
Example #2
0
        public async void VerifyingSetUser()
        {
            TestDbContext context = new TestDbContext();
            EmployeesController employeecontroller = new EmployeesController(context, null);
  
            Worker worker = new Worker
            {
                FirstName = "Fworkername",
                LastName = "Lworkername",
                Position = "SomeJobs",
                Status = true,
                Tasso = 10000
            };
            await employeecontroller.SetWorker(worker);
            Workman workman = context.Workmen.FirstOrDefault();
            
            Assert.Equal("Fworkername", workman.FirstName);
            Assert.True(workman.Tax == 1000);
            Assert.True(workman.TaxRate == 10);
            Assert.True(workman.Wages == 9000);

            context.Dispose();
        }