public void GetContractEmployeeProperties_ValidProperties_ReturnsValidContractEmployee() { // Initialize a string with input data and initalize other variables String dataToPassIn = "Anna\nMiller\n892398402\n1989\n07\n02\n2014\n02\n08\n2014\n09\n12\n25000"; ContractEmployee CTEmployee = new ContractEmployee(); 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 CTEmployee = (ContractEmployee)privateObject.Invoke("GetContractEmployeeProperties"); // Check if the expected result and actual result are the same Assert.AreEqual("Anna", CTEmployee.GetFirstName()); } }