コード例 #1
0
ファイル: AddEmployeeTests.cs プロジェクト: brandond12/EMS
        public void GetParttimeEmployeeProperties_ValidProperties_ReturnsValidParttimeEmployee()
        {
            // Initialize a string with input data and initalize other variables
            String dataToPassIn = "Mark\nSmith\n872098933\n1987\n06\n22\n2015\n11\n16\n30\n2013\n04\n12\n";
            ParttimeEmployee PTEmployee = new ParttimeEmployee();
            var privateObject = new PrivateObject(employeeRepo);

            // Set the console to read input from the input data string
            using (var input = new StringReader(dataToPassIn))
            {
                Console.SetIn(input);
                // Execute the method that is being tested
                PTEmployee = (ParttimeEmployee)privateObject.Invoke("GetParttimeEmployeeProperties");
                // Check if the expected result and actual result are the same
                Assert.AreEqual("Mark", PTEmployee.GetFirstName());
            }
        }