public void GetAllEmployees_Action_Fails() { // Arrange GenericServiceResponse <IEnumerable <EmployeeDto> > fakeResponse = null; mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable(); mockClientServicesProvider.Setup(x => x.EmployeeService.GetAllEmployees()).Returns(fakeResponse).Verifiable(); var viewModel = new GenericListViewModel <EmployeeDto>(); var action = new GetAllEmployees <GenericListViewModel <EmployeeDto> >(mockClientServicesProvider.Object) { OnComplete = model => viewModel = model }; // Act var result = action.Invoke(); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(GenericListViewModel <EmployeeDto>)); Assert.IsNotNull(result.Notifications); Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection)); Assert.IsTrue(result.Notifications.Count() == 1); Assert.IsTrue(result.HasErrors); Assert.IsNotNull(result.Items); Assert.IsTrue(result.Items.Count() == 0); Assert.IsInstanceOfType(result.Items, typeof(IEnumerable <EmployeeDto>)); Assert.IsTrue(result.Items.ToList().Count() == 0); }
public void ThenAllEmployeesShouldBeReturned() { using (var connection = GetDatabaseConnection.Create()) { sut = new GetAllEmployees(connection); var listOfAllEmployees = sut.Execute(); listOfAllEmployees.Count().Should().Be(NumberOfEmployeesToCreate); } }
public override void SetUp() { base.SetUp(); getAllEmployees = A.Fake <GetAllEmployees>(); getEmployeeById = A.Fake <GetEmployeeById>(); A.CallTo(() => queryFactory.Create <GetAllEmployees>()) .Returns(getAllEmployees); A.CallTo(() => queryFactory.Create <GetEmployeeById>()) .Returns(getEmployeeById); }
static void Main(string[] args) { while (true) { Console.Clear(); Console.WriteLine("YYYYYYYYYOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\n"); Console.WriteLine("1. Get all departments"); Console.WriteLine("2. Get department by ID"); Console.WriteLine("3. Add a department"); Console.WriteLine("4. Update a department"); Console.WriteLine("5. Delete a department"); Console.WriteLine("6. Get all employees"); Console.WriteLine("7. Get employee by ID"); Console.WriteLine("8. Get employees with their department"); Console.WriteLine("9. Add a employee"); Console.WriteLine("10. Update a employee"); Console.WriteLine("11. Delete a employee"); Console.WriteLine("12. Exit"); Console.WriteLine("YYYYYYYYYOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\n"); Console.WriteLine("Please Select an Action?"); Console.Write("> "); string option = Console.ReadLine(); if (option == "1") { GetAllDepartments.CollectInput(); } else if (option == "2") { DepartmentById.CollectInput(); } else if (option == "3") { AddDepartment.CollectInput(); } else if (option == "4") { UpdateDepartment.CollectInput(); } else if (option == "5") { DeleteDepartment.CollectInput(); } else if (option == "6") { GetAllEmployees.CollectInput(); } else if (option == "7") { EmployeeById.CollectInput(); } else if (option == "8") { EmployeesWithDepartment.CollectInput(); } else if (option == "9") { AddEmployee.CollectInput(); } else if (option == "10") { UpdateEmployee.CollectInput(); } else if (option == "11") { DeleteEmployee.CollectInput(); } else if (option == "12") { Console.WriteLine("Exit"); Console.ReadLine(); break; } else { Console.WriteLine($"Invalid : {option}"); Console.WriteLine($""); Console.ReadLine(); } } }
static void Main(string[] args) { while (true) { Console.Clear(); Console.WriteLine("-----------------------------------\n"); Console.WriteLine("1. Get all departments"); Console.WriteLine("2. Get department by ID"); Console.WriteLine("3. Add a department"); Console.WriteLine("4. Update a department"); Console.WriteLine("5. Delete a department"); Console.WriteLine("6. Get all employees"); Console.WriteLine("7. Get employee by ID"); Console.WriteLine("8. Get employees with their department"); Console.WriteLine("9. Add a employee"); Console.WriteLine("10. Update a employee"); Console.WriteLine("11. Delete a employee"); Console.WriteLine("12. Exit"); Console.WriteLine("\n-----------------------------------\n"); Console.WriteLine("What operation would you like to perform?"); Console.Write("> "); string option = Console.ReadLine(); if (option == "1") { GetAllDepartments.CollectInput(); } else if (option == "2") { DepartmentById.CollectInput(); } else if (option == "3") { AddDepartment.CollectInput(); } else if (option == "4") { UpdateDepartment.CollectInput(); } else if (option == "5") { DeleteDepartment.CollectInput(); } else if (option == "6") { GetAllEmployees.CollectInput(); } else if (option == "7") { EmployeeById.CollectInput(); } else if (option == "8") { EmployeesWithDepartment.CollectInput(); } else if (option == "9") { AddEmployee.CollectInput(); } else if (option == "10") { } else if (option == "11") { } else if (option == "12") { Console.WriteLine("Exiting program..."); Console.ReadLine(); break; } else { Console.WriteLine($"Invalid option: {option}"); Console.WriteLine($""); Console.ReadLine(); } } }
public async Task <IEnumerable <EmployeeRM> > Handle(GetAllEmployees message, CancellationToken token = default) { return(await _employeeRepository.GetAll(token)); }
public object Get(GetAllEmployees request) { return(WithDb(db => Logic.GetAll())); }
public async Task <IEnumerable <EmployeeDto> > Handle(GetAllEmployees request, CancellationToken cancellationToken) { return((await _employeesRepository.GetAll()).Select(x => new EmployeeDto())); }
public void SetUp() { sut = new GetAllEmployees(DatabaseConnection.Create()); }