Exemple #1
0
        public void CheckIfDayDeleted()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            Employee emp1 = new Employee()
            {
                FirstName = "Hamida",
                LastName  = "Hamidovic",
                Position  = context.Roles.Find("DEV")
            };

            Day d = new Day()
            {
                Date     = DateTime.Now,
                Hours    = 8m,
                Type     = DayType.WorkingDay,
                Employee = emp1
            };

            context.Employees.Add(emp1);
            context.Days.Add(d);
            context.SaveChanges();

            context.Days.Remove(d);
            context.SaveChanges();

            d = context.Days.FirstOrDefault(x => x.Employee.FirstName == emp1.FirstName);
            Assert.IsNull(d);
        }
Exemple #2
0
        protected override void Seed(TimeKeeperContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.
        }
        public void CheckCustomer()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            Address add = new Address();

            add.City    = "Sarajevo";
            add.Name    = "Bosmal";
            add.ZipCode = "71000";

            Customer c = new Customer()
            {
                Name           = "Mistral Technologies",
                Image          = null,
                Monogram       = null,
                Contact        = "Sulejman Catibusic",
                Email          = "*****@*****.**",
                Phone          = "+38761200333",
                StatusCustomer = StatusCustomer.Client,
                Address        = add
            };

            context.Customers.Add(c);
            context.SaveChanges();

            Assert.AreEqual("Sulejman Catibusic", c.Contact);
        }
Exemple #4
0
        public void CheckDay()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            Employee emp1 = new Employee()
            {
                FirstName = "Tester",
                LastName  = "Testerovski",
                Position  = context.Roles.Find("DEV")
            };

            Day d = new Day()
            {
                Date     = DateTime.Now,
                Hours    = 8m,
                Type     = DayType.WorkingDay,
                Employee = emp1
            };

            context.Employees.Add(emp1);
            context.Days.Add(d);
            context.SaveChanges();

            Assert.AreEqual(8, d.Hours);
        }
Exemple #5
0
        public void GetAllDaysSuccess()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            Employee emp1 = new Employee()
            {
                FirstName = "Testera",
                LastName  = "Testerovic",
                Position  = context.Roles.Find("DEV")
            };

            Day d = new Day()
            {
                Date     = DateTime.Now,
                Hours    = 8m,
                Type     = DayType.WorkingDay,
                Employee = emp1
            };

            context.Employees.Add(emp1);
            context.Days.Add(d);

            var controller = new DaysController();

            var response = controller.Get(1);
            var result   = (OkNegotiatedContentResult <DayModel>)response;

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Content);
        }
        public void CheckEmployee()
        {
            //Arrange
            TimeKeeperContext context = new TimeKeeperContext();

            Employee emp1 = new Employee()
            {
                FirstName = "Esma",
                LastName  = "Holjan",
                Position  = context.Roles.Find("DEV")
            };

            Employee emp2 = new Employee()
            {
                FirstName = "Bekac",
                LastName  = "Beks",
                Position  = context.Roles.Find("DEV"),
            };

            //Act
            context.Employees.Add(emp1);
            context.Employees.Add(emp2);
            context.SaveChanges();

            //Assert
            Assert.AreEqual("Esma", emp1.FirstName);
            Assert.AreEqual("Beks", emp2.LastName);
        }
 public ReportsController(TimeKeeperContext context) : base(context)
 {
     monthlyOverview = new MonthlyOverview(Unit);
     annualOverview  = new AnnualOverview(Unit);
     projectHistory  = new ProjectHistory(Unit);
     timeTracking    = new TimeTracking(Unit);
 }
Exemple #8
0
        public void CheckProject()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            //Arrange
            Team t = new Team()
            {
                Id    = "n01",
                Image = null,
                Name  = "Navajo team"
            };

            context.Teams.Add(t);
            context.SaveChanges();

            Address add = new Address
            {
                City    = "Sarajevo",
                Name    = "Bosmal",
                ZipCode = "71000"
            };

            //Customer c = new Customer()
            //{
            //    Name = "Mistral Technologies",
            //    Image = null,
            //    Monogram = null,
            //    Contact = "Sulejman Catibusic",
            //    Email = "*****@*****.**",
            //    Phone = "+38761200333",
            //    StatusCustomer = StatusCustomer.Client,
            //    Address = add
            //};

            //context.Customers.Add(c);
            //context.SaveChanges();

            Project p = new Project()
            {
                Name          = "TimeKeeper",
                Description   = "Application for time tracking",
                Amount        = 1000,
                BeginDate     = DateTime.Now,
                EndDate       = DateTime.Now,
                StatusProject = StatusProject.InProgress,
                Pricing       = Pricing.HourlyRate,
                //Customer = c,
                Team = t
            };

            //Act
            context.Projects.Add(p);
            context.SaveChanges();

            //Assert
            Assert.AreEqual("TimeKeeper", p.Name);
            //Assert.AreEqual("Mistral Technologies", p.Customer.Name);
            Assert.AreEqual("Navajo team", p.Team.Name);
        }
 public BasicAuthenticationHandler(
     IOptionsMonitor <AuthenticationSchemeOptions> options,
     ILoggerFactory logger, UrlEncoder encoder,
     ISystemClock clock,
     TimeKeeperContext context) : base(options, logger, encoder, clock)
 {
     _unit = new UnitOfWork(context);
 }
Exemple #10
0
        public void SetUp()
        {
            string   conStr       = "User ID=postgres; Password=admin; Server=localhost; Port=5432; Database=testera; Integrated Security=true; Pooling=true;";
            FileInfo fileLocation = new FileInfo(@"C:\TimeKeeper_DATA\TimeKeeperTest.xlsx");

            context = new TimeKeeperContext(conStr);
            unit    = new UnitOfWork(context);
            unit.Seed(fileLocation);
        }
Exemple #11
0
        public void CheckRoles()
        {
            //Arrange
            TimeKeeperContext context = new TimeKeeperContext();
            //Act
            int roles = context.Roles.Count();

            //Assert
            Assert.AreEqual(2, roles);
        }
        public void CheckIfProjDeleted()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            Team t = new Team()
            {
                Id    = "n03",
                Image = null,
                Name  = "Navajo team"
            };

            Address add = new Address
            {
                City    = "Sarajevo",
                Name    = "Bosmal",
                ZipCode = "71000"
            };

            Customer c = new Customer()
            {
                Name           = "Mistral Technologies",
                Image          = null,
                Monogram       = null,
                Contact        = "Sulejman Catibusic",
                Email          = "*****@*****.**",
                Phone          = "+38761200333",
                StatusCustomer = StatusCustomer.Client,
                Address        = add
            };

            Project p = new Project()
            {
                Name          = "Testera",
                Description   = "Application for wood cutting",
                Amount        = 1000,
                BeginDate     = DateTime.Now,
                EndDate       = DateTime.Now,
                StatusProject = StatusProject.InProgress,
                Pricing       = Pricing.HourlyRate,
                Customer      = c,
                Team          = t
            };

            //Act
            context.Projects.Add(p);
            context.SaveChanges();

            context.Projects.Remove(p);
            context.SaveChanges();

            p = context.Projects
                .FirstOrDefault(x => x.Name == "Testera");
            Assert.IsNull(p);
        }
        public void SetUp()
        {
            string conStr = "User ID=postgres; Password=postgres; Server=localhost; Port=5432; Database=TKTestera; Integrated Security=true; Pooling=true;";
            //Paths for test Excel databases
            FileInfo fileStatuses = new FileInfo(@"C:\Projects\TimeKeeper\TimeKeeper.Test\TestDatabase\TimeKeeperStatusesTest.xlsx");
            FileInfo file         = new FileInfo(@"C:\Projects\TimeKeeper\TimeKeeper.Test\TestDatabase\TimeKeeperTest.xlsx");

            context = new TimeKeeperContext(conStr);
            unit    = new UnitOfWork(context);
            unit.SeedDatabase(file, fileStatuses);
        }
Exemple #14
0
        public void CheckIfUpdated()
        {
            TimeKeeperContext context = new TimeKeeperContext();
            Employee          emp1    = new Employee()
            {
                FirstName = "Bekir",
                LastName  = "Beks",
                Position  = context.Roles.Find("DEV"),
            };

            context.Employees.AddOrUpdate(emp1);
            context.SaveChanges();

            Assert.AreEqual("Bekir", emp1.FirstName);
        }
        public void CheckIfDeletedEmp()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            Employee emp = new Employee()
            {
                FirstName = "Bekir",
                LastName  = "Bukvarevic",
                Position  = context.Roles.Find("DEV")
            };

            //Act
            context.Employees.Add(emp);
            context.SaveChanges();

            context.Employees.Remove(emp);
            context.SaveChanges();

            //Assert
            emp = context.Employees
                  .FirstOrDefault(x => x.FirstName == "Bekir");
            Assert.IsNull(emp);
        }
Exemple #16
0
        public void GetEngagementsSuccess()
        {
            TimeKeeperContext context = new TimeKeeperContext();

            Team t = new Team()
            {
                Id    = "n04",
                Image = null,
                Name  = "NavajoO team"
            };

            Employee emp1 = new Employee()
            {
                FirstName = "Hamo",
                LastName  = "Hamic",
                Position  = context.Roles.Find("DEV")
            };

            Engagement eng1 = new Engagement()
            {
                Hours    = 40m,
                Employee = emp1,
                Team     = t,
                Role     = context.Roles.Find("SD")
            };

            context.Engagements.Add(eng1);
            context.SaveChanges();

            var controller = new EngagementsController();

            var response = controller.Get(1);
            var result   = (OkNegotiatedContentResult <EngagementModel>)response;

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Content);
        }
Exemple #17
0
 public MasterController(TimeKeeperContext context) : base(context)
 {
 }
 public CustomersController(TimeKeeperContext context) : base(context)
 {
     _pagination = new PaginationService <Customer>();
 }
Exemple #19
0
 public UsersController(TimeKeeperContext context) : base(context)
 {
 }
Exemple #20
0
 public ProjectsController(TimeKeeperContext context) : base(context)
 {
 }
Exemple #21
0
 public AdminLeadOrMemberHandler(TimeKeeperContext context)
 {
     Unit = new UnitOfWork(context);
 }
Exemple #22
0
 public Repository(TimeKeeperContext context)
 {
     timeKeeperContext = context;
     dbSet             = context.Set <T>();
 }
Exemple #23
0
 public EmployeesController(TimeKeeperContext context) : base(context)
 {
 }
 public CalendarController(TimeKeeperContext context) : base(context)
 {
     calendarService = new CalendarService(Unit);
 }
 public BaseController(TimeKeeperContext context)
 {
     Unit           = new UnitOfWork(context);
     Access         = new AccessHandler(Unit);
     resourceAccess = new ResouceAccessHandler(Unit);
 }
 public EmployeeRepository(TimeKeeperContext context) : base(context)
 {
 }
 public UnitOfWork(TimeKeeperContext context)
 {
     this.context = context;
 }
Exemple #28
0
 public RolesController(TimeKeeperContext context) : base(context)
 {
 }
 public void SetUp()
 {
     context = new TimeKeeperContext();
     unit    = new UnitOfWork(context);
 }
 public BaseController(TimeKeeperContext context)
 {
     Unit = new UnitOfWork(context);
 }