public void GetsAllEmployees() { var mockParent = new Mock <IEmployeeSelectorAdderVMParent>(); var vm = new EmployeeSelectorAdderVM(mockParent.Object, FakeDatabase.GetDB().Object); var empList = vm.EmployeeList; Assert.That(empList.Count, Is.EqualTo(4)); }
public void FindsManagerBySearch() { var mockParent = new Mock <IEmployeeSelectorAdderVMParent>(); var vm = new EmployeeSelectorAdderVM(mockParent.Object, FakeDatabase.GetDB().Object); vm.SearchQuery = "Mana"; var empList = vm.EmployeeList; Assert.That(empList.Count, Is.EqualTo(1)); Assert.That(empList.FirstOrDefault().FullName, Is.EqualTo("Manager Testerson")); }
public void CallsRemove() { var mockParent = new Mock <IEmployeeSelectorAdderVMParent>(); var vm = new EmployeeSelectorAdderVM(mockParent.Object, FakeDatabase.GetDB().Object); var employeeToDelete = vm.EmployeeList.FirstOrDefault(); vm.SelectedEmployee = employeeToDelete; vm.RemoveEmployee.Execute(null); mockParent.Verify(m => m.OnRemoveEmployee(It.IsAny <object>()), Times.Once); }