Skip to content
Snippets Groups Projects
Commit 1020c99e authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

metsastys alku

parent afd29aa0
No related branches found
No related tags found
No related merge requests found
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/modules.xml
/.idea.live07.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
\ No newline at end of file
public class Laskuja
{
public static void Main()
{
int a = 5, b = 3;
int c = Vahenna(a,b);
System.Console.WriteLine(c);
c = Vahenna(a,4);
System.Console.WriteLine(c);
}
/// <summary>
/// Funktio laskeea lukujen a ja b erotuksen
/// </summary>
/// <param name="a">luku josta vähennetään</param>
/// <param name="b">luku joka vähennetään</param>
/// <returns>a-b</returns>
/// <example>
/// <pre name="test">
/// Vahenna(0, 0) === 0;
/// Vahenna(5, 2) === 3;
/// Vahenna(2, 5) === -3;
/// Vahenna(4, -2) === 6;
/// </pre>
/// </example>
public static int Vahenna(int a, int b)
{
int tulos = a - b;
return tulos;
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
</Project>
using NUnit.Framework;
using static Laskuja;
[TestFixture]
[DefaultFloatingPointTolerance(0.000001)]
public class TestLaskuja
{
[Test]
public void TestVahenna20()
{
Assert.AreEqual( 0, Vahenna(0, 0) , "in method Vahenna, line 21");
Assert.AreEqual( 3, Vahenna(5, 2) , "in method Vahenna, line 22");
Assert.AreEqual( -3, Vahenna(2, 5) , "in method Vahenna, line 23");
Assert.AreEqual( 6, Vahenna(4, -2) , "in method Vahenna, line 24");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.1"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Laskuja\Laskuja.csproj"/>
</ItemGroup>
</Project>

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Laskuja", "Laskuja\Laskuja.csproj", "{2647682B-66A0-4935-9D2E-F3F99876BA0D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaskujaTest", "LaskujaTest\LaskujaTest.csproj", "{F908170C-A726-4E5A-BCFD-731D2F645223}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Release|Any CPU.Build.0 = Release|Any CPU
{F908170C-A726-4E5A-BCFD-731D2F645223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F908170C-A726-4E5A-BCFD-731D2F645223}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F908170C-A726-4E5A-BCFD-731D2F645223}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F908170C-A726-4E5A-BCFD-731D2F645223}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Laskuja", "Laskuja\Laskuja.csproj", "{2647682B-66A0-4935-9D2E-F3F99876BA0D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2647682B-66A0-4935-9D2E-F3F99876BA0D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment