コード例 #1
0
        public void CompareTo_Equal_Test()
        {
            Assignment1.Employee employee1 = new Assignment1.Employee(1, "First", "Employee");
            Assignment1.Employee employee2 = new Assignment1.Employee(1, "Second", "Employee");

            Assert.That(employee1.CompareTo(employee2) == 0);
            // Assert.Fail(); // you may delete this line after uncommenting the above code
        }
コード例 #2
0
        public void CompareTo_First_is_Lower_Test()
        {
            Assignment1.Employee employee1 = new Assignment1.Employee(1, "First", "Employee");
            Assignment1.Employee employee2 = new Assignment1.Employee(2, "Second", "Employee");

            Assert.That(employee1.CompareTo(employee2), Is.LessThan(0));
            //Assert.Fail(); // you may delete this line after uncommenting the above code
        }
コード例 #3
0
        public void ToString_with_no_names_shows_Nulls_Test()
        {
            int employeeId = 1;

            Assignment1.Employee employee = new Assignment1.Employee(employeeId);

            string expectedToString = $"{employeeId} null null";

            Assert.That(employee.ToString(), Is.EqualTo(expectedToString));
            //Assert.Fail(); // you may delete this line after uncommenting the above code
        }
コード例 #4
0
        public void EmployeeId_Constructor_Test()
        {
            int employeeId = 32;

            Assignment1.Employee employee = new Assignment1.Employee(employeeId);

            Assert.That(employee, Is.Not.Null);
            Assert.That(employee.EmployeeID, Is.EqualTo(employeeId));
            Assert.That(employee.FirstName, Is.EqualTo(null));
            Assert.That(employee.LastName, Is.EqualTo(null));
            //Assert.Fail(); // you may delete this line after uncommenting the above code
        }
コード例 #5
0
        public void ToString_Test()
        {
            int    employeeId = 1;
            string firstName  = "First";
            string lastName   = "Employee";

            Assignment1.Employee employee = new Assignment1.Employee(employeeId, firstName, lastName);

            string expectedToString = $"{employeeId} {firstName} {lastName}";

            Assert.That(employee.ToString(), Is.EqualTo(expectedToString));
            // Assert.Fail(); // you may delete this line after uncommenting the above code
        }
コード例 #6
0
        public void FullEmployee_Constructor_Test()
        {
            int    employeeid = 32;
            string firstname  = "john";
            string lastname   = "smith";

            Assignment1.Employee employee = new Assignment1.Employee(employeeid, firstname, lastname);

            Assert.That(employee, Is.Not.Null);
            Assert.That(employee.EmployeeID, Is.EqualTo(employeeid));
            Assert.That(employee.FirstName, Is.EqualTo(firstname));
            Assert.That(employee.LastName, Is.EqualTo(lastname));
            //Assert.Fail(); // you may delete this line after uncommenting the above code
        }