diff --git a/Bankos.sln b/Bankos.sln new file mode 100644 index 0000000..401431e --- /dev/null +++ b/Bankos.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32413.511 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bankos", "Bankos\Bankos.csproj", "{3E80B462-491A-40C9-9E32-A651C92FBB6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BankTest", "TestProject1\BankTest.csproj", "{2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3E80B462-491A-40C9-9E32-A651C92FBB6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E80B462-491A-40C9-9E32-A651C92FBB6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E80B462-491A-40C9-9E32-A651C92FBB6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E80B462-491A-40C9-9E32-A651C92FBB6C}.Release|Any CPU.Build.0 = Release|Any CPU + {2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {057D358D-F849-4AE9-813B-5101D7A80DF8} + EndGlobalSection +EndGlobal diff --git a/Bankos/Bankos.csproj b/Bankos/Bankos.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/Bankos/Bankos.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Bankos/Program.cs b/Bankos/Program.cs new file mode 100644 index 0000000..1bde655 --- /dev/null +++ b/Bankos/Program.cs @@ -0,0 +1,49 @@ +using System; + +namespace Bankos +{ + class Program + { + static void Main(string[] args) + { + BankAdat ba = new BankAdat("Kiss Péter", 1000); + Console.WriteLine(ba.getEgyenleg()); + + } + + } + + public class BankAdat + { + private string nev; + private int egyenleg; + + public BankAdat (string benev, int egyen) + { + nev = benev; + egyenleg = egyen; + } + + public int getEgyenleg () + { + return egyenleg; + } + + public void Kivet(int osszeg) + { + if (osszeg>egyenleg) + { + throw new ArgumentOutOfRangeException("osszeg"); + } + if (osszeg < 0) + { + throw new ArgumentOutOfRangeException("osszeg"); + } + if (osszeg<=egyenleg && osszeg>0) + { + egyenleg -= osszeg; + } + } + } +} + diff --git a/TestProject1/BankTest.csproj b/TestProject1/BankTest.csproj new file mode 100644 index 0000000..41c25aa --- /dev/null +++ b/TestProject1/BankTest.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp3.1 + + false + + + + + + + + + + + + + + diff --git a/TestProject1/UnitTest1.cs b/TestProject1/UnitTest1.cs new file mode 100644 index 0000000..88e9a64 --- /dev/null +++ b/TestProject1/UnitTest1.cs @@ -0,0 +1,22 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Bankos; + +namespace BankTest +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + int kezdegyenleg = 1000; + int csokkento = 300; + int elvart = 700; + + BankAdat ba = new BankAdat("Kiss Péter", kezdegyenleg); + ba.Kivet(csokkento); + int eredmeny = ba.getEgyenleg(); + Assert.AreEqual(elvart, eredmeny); + } + } +}