Пример #1
0
        public void GetFulltimeEmployeeProperties_ValidProperties_ReturnsValidFulltimeEmployee()
        {
            // Initialize a string with input data and initalize other variables
            String dataToPassIn = "Sam\nJones\n902398402\n1990\n09\n10\n2015\n06\n28\n2010\n10\n11\n50000";
            FulltimeEmployee FTEmployee = new FulltimeEmployee();
            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
                FTEmployee = (FulltimeEmployee)privateObject.Invoke("GetFulltimeEmployeeProperties");
                // Check if the expected result and actual result are the same
                Assert.AreEqual("Sam", FTEmployee.GetFirstName());
            }
        }