Adding Method Displayer, and renaming projects
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
namespace BasicProgramming
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var methodCollections = new List<IMethodCollection>()
|
||||
{
|
||||
new Basic(),
|
||||
new Statement(),
|
||||
new Loops(),
|
||||
new Strings()
|
||||
};
|
||||
|
||||
methodCollections.ForEach(x =>
|
||||
{
|
||||
Console.WriteLine($"====== {x.GetType().Name} ======");
|
||||
x.DisplayAllMethods();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public interface IMethodCollection
|
||||
{
|
||||
public void DisplayAllMethods();
|
||||
}
|
||||
}
|
||||
14
MethodDisplayer/MethodDisplayer.csproj
Normal file
14
MethodDisplayer/MethodDisplayer.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../MethodLibrary/MethodLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
24
MethodDisplayer/Program.cs
Normal file
24
MethodDisplayer/Program.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using MethodLibrary;
|
||||
|
||||
namespace MethodDisplayer
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var methodCollections = new List<IMethodCollection>
|
||||
{
|
||||
new Basic(),
|
||||
new Statement(),
|
||||
new Loops(),
|
||||
new Strings()
|
||||
};
|
||||
|
||||
foreach (var method in methodCollections)
|
||||
{
|
||||
Console.WriteLine($"====== {method.GetType().Name} ======");
|
||||
method.DisplayAllMethods();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicProgramming", "BasicProgramming\BasicProgramming.csproj", "{F852DB4D-952E-CFAF-DFC6-298FB48C8A28}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MethodLibrary", "MethodLibrary\MethodLibrary.csproj", "{F852DB4D-952E-CFAF-DFC6-298FB48C8A28}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicProgrammingTests", "BasicProgrammingUnitTest\BasicProgrammingTests.csproj", "{427B1690-1D9B-4002-A6DE-435867230BAC}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MethodLibraryTests", "MethodLibraryTests\MethodLibraryTests.csproj", "{427B1690-1D9B-4002-A6DE-435867230BAC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MethodDisplayer", "MethodDisplayer\MethodDisplayer.csproj", "{204AEF70-C8DC-4FB7-A2F6-D4BAEBBA20EB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -20,6 +22,10 @@ Global
|
||||
{427B1690-1D9B-4002-A6DE-435867230BAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{427B1690-1D9B-4002-A6DE-435867230BAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{427B1690-1D9B-4002-A6DE-435867230BAC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{204AEF70-C8DC-4FB7-A2F6-D4BAEBBA20EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{204AEF70-C8DC-4FB7-A2F6-D4BAEBBA20EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{204AEF70-C8DC-4FB7-A2F6-D4BAEBBA20EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{204AEF70-C8DC-4FB7-A2F6-D4BAEBBA20EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BasicProgramming
|
||||
namespace MethodLibrary
|
||||
{
|
||||
public class Basic : IMethodCollection
|
||||
{
|
||||
7
MethodLibrary/IMethodCollection.cs
Normal file
7
MethodLibrary/IMethodCollection.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace MethodLibrary
|
||||
{
|
||||
public interface IMethodCollection
|
||||
{
|
||||
public void DisplayAllMethods();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BasicProgramming
|
||||
namespace MethodLibrary
|
||||
{
|
||||
public class Loops : IMethodCollection
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace BasicProgramming
|
||||
namespace MethodLibrary
|
||||
{
|
||||
public class Statement : IMethodCollection
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BasicProgramming
|
||||
namespace MethodLibrary
|
||||
{
|
||||
public class Strings : IMethodCollection
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
using BasicProgramming;
|
||||
using MethodLibrary;
|
||||
|
||||
namespace BasicProgrammingTests;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BasicProgramming;
|
||||
using MethodLibrary;
|
||||
|
||||
namespace BasicProgrammingTests;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../BasicProgramming/BasicProgramming.csproj" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../MethodLibrary/MethodLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -1,4 +1,4 @@
|
||||
using BasicProgramming;
|
||||
using MethodLibrary;
|
||||
|
||||
namespace BasicProgrammingTests;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BasicProgramming;
|
||||
using MethodLibrary;
|
||||
|
||||
namespace BasicProgrammingTests;
|
||||
|
||||
@@ -1 +1,9 @@
|
||||
# Basic Programming
|
||||
|
||||
Velkommen til projektet hvor jeg måske har overengineeret en smule meget.
|
||||
|
||||
Det er et par skole opgaver, hvor man skulle skrive nogle metoder, og derefter lave unit tests.
|
||||
|
||||
Jeg har måske kommet til at tage det skridtet videre.
|
||||
|
||||
Der er blevet lavet en klasse til hver opgave, så Basic opgaven har klassen Basic osv. Herefter er der blevet implementeret et interface på alle klasserne som jeg kalder en Metode Collection, som sørger for at alle klasserne, har en metode som skriver alle test scenarier ud i konsollen. Dette kan listen i Program.cs bruge til at sørge for at alle Metoder bliver printet i konsolen.
|
||||
Reference in New Issue
Block a user