Exemple #1
0
        public void GetSeasonalEmployeeProperties_ValidProperties_ReturnsValidSeasonalEmployee()
        {
            // Initialize a string with input data and initalize other variables
            String dataToPassIn = "Jake\nWilliams\n912098933\n1991\n03\n18\nFall\n20\n";
            SeasonalEmployee SNEmployee = new SeasonalEmployee();
            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
                SNEmployee = (SeasonalEmployee)privateObject.Invoke("GetSeasonalEmployeeProperties");
                // Check if the expected result and actual result are the same
                Assert.AreEqual("Jake", SNEmployee.GetFirstName());
            }
        }