mer unit test
This commit is contained in:
parent
8ff1f69ea3
commit
5b6d47da85
15 changed files with 386 additions and 0 deletions
10
Emne 3/Calc/Calc/Calc.csproj
Normal file
10
Emne 3/Calc/Calc/Calc.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
29
Emne 3/Calc/Calc/Calculator.cs
Normal file
29
Emne 3/Calc/Calc/Calculator.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
namespace Calc;
|
||||
|
||||
public class Calculator
|
||||
{
|
||||
public int LeggSammen(int a, int b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
public int TrekkFra(int a, int b)
|
||||
{
|
||||
return a - b;
|
||||
}
|
||||
|
||||
public int Multipliser(int a, int b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
public int Divider(int a, int b)
|
||||
{
|
||||
if (b == 0)
|
||||
{
|
||||
throw new ArgumentException("Cannot divide by zero.");
|
||||
}
|
||||
return a / b;
|
||||
}
|
||||
|
||||
}
|
3
Emne 3/Calc/Calc/Program.cs
Normal file
3
Emne 3/Calc/Calc/Program.cs
Normal file
|
@ -0,0 +1,3 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
Loading…
Add table
Add a link
Reference in a new issue