mardi 5 février 2019

How would i test this c# method in the program

How would I test this method within the code? Do I just need to put a value into the inputs I have or something else? I'm not to sure

    static Song InputSongDetails()
    {
        Console.WriteLine("What is the name of your song");
        string name = Console.ReadLine();

        Console.WriteLine("What is the artists name");
        string artist = Console.ReadLine();

        int records;
        Console.WriteLine("How many records did it sell");
        while (!int.TryParse(Console.ReadLine(), out records) || records < 0)
        {
            Console.WriteLine("That is not valid please enter a number");
        }
        return new Song(name, artist, records);
    }
}

}

Aucun commentaire:

Enregistrer un commentaire