Hey guys,
so i'm sitting here actually for hours now trying to figure out, how i can make my Code testable, i'm pretty new to C# so i don't have really any knowledge and would appreciate some help!
So this is my current code. My Instructor told me that i have to create a new Method that is testable with an unit test but i cant figure out how i'm supposed to do this .
so i'm sitting here actually for hours now trying to figure out, how i can make my Code testable, i'm pretty new to C# so i don't have really any knowledge and would appreciate some help!
So this is my current code. My Instructor told me that i have to create a new Method that is testable with an unit test but i cant figure out how i'm supposed to do this .
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace fisbas
{
public class Program
{
static void Main(string[] args)
{
int fis;
int bas;
Console.WriteLine("Type in the Value for Fis:");
int.TryParse(Console.ReadLine(), out fis);
Console.WriteLine("Type in the Value for Bas:");
int.TryParse(Console.ReadLine(), out bas);
FisBasRechner(fis,bas);
}
public static void FisBasRechner(int fis, int bas){
for (int i = 0; i <= 100; i++)
{
if ( i % fis == 0 && i % bas == 0)
{
Console.WriteLine("FisBas");
}
else if ( i % fis == 0)
{
Console.WriteLine("Fis");
}
else if ( i % bas == 0)
{
Console.WriteLine("Bas");
}
else
{
Console.WriteLine(i);
}
}
Console.ReadLine();
}
}
}
Last edited by a moderator: