Пример #1
0
        public void WhenSaveEmployeeShouldReturnSucess(Employee employee)
        {
            EmployeeMock.AddDepartment(employee);
            var sucess = OperationEmployee.Save(employee);

            Assert.IsTrue(sucess, "Error saving employee.");
        }
Пример #2
0
 public void Initialize()
 {
     mockEmployee       = new EmployeeMock();
     employeeRepository = new EmployeeRepository(mockEmployee);
     employee           = new EmployeeModel();
     token = default(global::System.Threading.CancellationToken);
 }
    public void DeleteTestIDZero()
    {
        var Employee = new EmployeeMock();
        var count    = Employee.EmployeeCollection().Count;

        Employee.Delete(0);
        Assert.AreEqual(count, Employee.EmployeeCollection().Count);
    }
    public void GetTest()
    {
        var Employee = new EmployeeMock();
        var myEmp    = Employee.EmployeeCollection().FirstOrDefault();

        Employee.Employee(myEmp.id);
        Assert.AreEqual(myEmp.Name, Employee.Employee(myEmp.id).Name);
    }
    public void DeleteTest()
    {
        var Employee = new EmployeeMock();
        var myEmp    = Employee.EmployeeCollection().FirstOrDefault();
        var count    = Employee.EmployeeCollection().Count;

        Employee.Delete(myEmp.id);
        Assert.AreEqual(count - 1, Employee.EmployeeCollection().Count);
    }
    public void UpdateTestInvalidId()
    {
        var Employee = new EmployeeMock();
        var myEmp    = new EmployeeModel {
            id = 99999
        };

        Assert.AreEqual(99999, Employee.Update(myEmp).id);
    }
    public void UpdateTest()
    {
        var Employee = new EmployeeMock();
        var myEmp    = Employee.EmployeeCollection().FirstOrDefault();
        var NewName  = "NewName";

        myEmp.Name = NewName;
        Employee.Update(myEmp);
        Assert.AreEqual(NewName, Employee.Employee(myEmp.id).Name);
    }
    public void EmployeeCollectionExpectedBehavior()
    {
        // Arrange
        var employeeMock = new EmployeeMock();

        // Act
        var result = employeeMock.EmployeeCollection();

        // Assert
        Assert.AreNotEqual(result.Count, 0);
    }
    public void EmployeeExpectedBehavior()
    {
        // Arrange
        var employeeMock = new EmployeeMock();
        int id           = 0;

        // Act
        var result = employeeMock.Employee(id);

        // Assert
        Assert.IsFalse(result.IsValid);
    }
    public void UpdateExpectedBehavior()
    {
        // Arrange
        var           employeeMock = new EmployeeMock();
        EmployeeModel emp          = null;

        // Act
        var result = employeeMock.Update(emp);

        // Assert
        Assert.AreEqual(result.id, 0);
    }
    public void DeleteExpectedBehavior()
    {
        // Arrange
        var employeeMock = new EmployeeMock();
        int ID           = 0;

        // Act
        var result = employeeMock.Delete(ID);

        // Assert
        Assert.AreEqual(result, false);
    }
Пример #12
0
        // GET: Search
        public ActionResult Index(string requsest)
        {
            EmployeeMock mock = new EmployeeMock();

            if (String.IsNullOrEmpty(requsest))

            {
                //   var searchRequest = mock.Employees.
                //                      Where(x => x.TravelRoute == requsest || x.TravelPoint2 == requsest || x.TravelPoint3 == requsest || x.TravelPoint4 == requsest);
                //Default Search
                //GET user's default points
                // Put them in search model
                //Return all results

                //Custom search
                //User put request - some point
                // Get results

                //Custom search2
                // User can select existed points and get all drivers which correspond to these points
            }
            return(View());
        }
Пример #13
0
        public Task <Employee> GetEmployee(int EmployeeID)
        {
            var employeeMock = new EmployeeMock();

            return(Task.FromResult(employeeMock.GetEmployeeMockData(EmployeeID)));
        }
Пример #14
0
        public Task <List <Employee> > GetEmployee()
        {
            var employeeMock = new EmployeeMock();

            return(Task.FromResult(employeeMock.GetEmployeeMockData()));
        }
    public void EmployeeMockTest()
    {
        var Employee = new EmployeeMock();

        Assert.AreNotEqual(0, Employee.EmployeeCollection().Count);
    }
    public void GetTestIDZero()
    {
        var Employee = new EmployeeMock();

        Assert.AreEqual(null, Employee.Employee(0)?.Name);
    }