Private
Public Access
Converting to Linux new lines before final publish.
This commit is contained in:
1 parent
ab94e98508
commit
ea2360f2a6
667 files changed
+68755
-8530
No files matched your search
+43
-43
@@ -1,43 +1,43 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>Advanced_Software_Engineering_Tests</RootNamespace>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<OutputType>WinExe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>C:\Users\Uni\Documents\Projects\Advanced Software Engineering\Advanced Software Engineering\Advanced Software Engineering Tests\Advanced Software Engineering Tests.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Advanced Software Engineering\Advanced Software Engineering.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>Advanced_Software_Engineering_Tests</RootNamespace>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<OutputType>WinExe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>C:\Users\Uni\Documents\Projects\Advanced Software Engineering\Advanced Software Engineering\Advanced Software Engineering Tests\Advanced Software Engineering Tests.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Advanced Software Engineering\Advanced Software Engineering.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+242
-242
@@ -1,242 +1,242 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Advanced Software Engineering Tests</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.CommandTester">
|
||||
<summary>
|
||||
The CommandTester class tests the commands possible, mostly by getting a IVerb and checking it's description..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.VerbFactoryTester_Automatic1">
|
||||
<summary>
|
||||
Automatically tests:
|
||||
- moveto
|
||||
- drawto
|
||||
- line
|
||||
- rp
|
||||
Current todo list:
|
||||
- square
|
||||
- rectangle
|
||||
- circle
|
||||
- triangle
|
||||
- dot
|
||||
- clear
|
||||
- pen
|
||||
- fill
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.MoveToTester_Manual1">
|
||||
<summary>
|
||||
tests the "move" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.MoveTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.MoveToTester_Manual2">
|
||||
<summary>
|
||||
tests the "moveto" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.MoveTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DrawToTester_Manual1">
|
||||
<summary>
|
||||
tests the "drawto" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.DrawTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DrawToTester_Manual2">
|
||||
<summary>
|
||||
tests the "line" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.DrawTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DrawToTester_Manual3">
|
||||
<summary>
|
||||
tests the "lineto" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.DrawTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual1">
|
||||
<summary>
|
||||
tests the "regularpolygon" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual2">
|
||||
<summary>
|
||||
tests the "rp" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual3">
|
||||
<summary>
|
||||
tests the "regularpolygon" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual4">
|
||||
<summary>
|
||||
tests the "rp" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.SquareTester_Manual1">
|
||||
<summary>
|
||||
tests the "square" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Square"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.SquareTester_Manual2">
|
||||
<summary>
|
||||
tests the "square" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Square"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.CircleTester_Manual1">
|
||||
<summary>
|
||||
Tests the "circle" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Circle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.TriangleTester_Manual1">
|
||||
<summary>
|
||||
tests the "triangle" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Triangle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.TriangleTester_Manual2">
|
||||
<summary>
|
||||
tests the "triangle" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Triangle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DotTester_Manual1">
|
||||
<summary>
|
||||
test the "dot" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Dot"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ClearTester_Manual1">
|
||||
<summary>
|
||||
tests the "clear" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Circle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ResetPenTester_Manual1">
|
||||
<summary>
|
||||
Tests the "reset" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.ResetPen"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ResetPenTester_Manual2">
|
||||
<summary>
|
||||
Tests the "resetpen" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.ResetPen"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.PenTester_Manual1">
|
||||
<summary>
|
||||
Tests the command "pen". See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.PenColor"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.FillTester_Manual1">
|
||||
<summary>
|
||||
Tests the command "fill". See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.FillColor"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.IfTester_Manual1">
|
||||
<summary>
|
||||
Tests the "if" command. It hasn't been implemented yet.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.MethodTester_Manual1">
|
||||
<summary>
|
||||
Tests the "def" command. It hasn't been implemented yet.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ValueTester_Manual1">
|
||||
<summary>
|
||||
Tests the "int" declaration and assignment. It hasn't been implemented yet.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.HelperFunctionsTester">
|
||||
<summary>
|
||||
This class tests <see cref="T:Advanced_Software_Engineering.HelperFunctions"/> methods. It uses a combination of manual and random tests.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.Strip_Random1">
|
||||
<summary>
|
||||
Random strip spaces test
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.Strip_Manual1">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.Strip(System.String)"/> test
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.Strip_Manual2">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.Strip(System.String)"/> test
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.StripStringArray_Manual1">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.StripStringArray(System.String[])"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.StripStringArray_Manual2">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.StripStringArray(System.String[])"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual1">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual2">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual3">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual4">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Random1">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.Properties.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Advanced_Software_Engineering_Tests.Properties.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Advanced_Software_Engineering_Tests.Properties.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.ValueHelperTester">
|
||||
<summary>
|
||||
This class tests <see cref="T:Advanced_Software_Engineering.Verbs.Value.ValueHelper"/> methods. It uses a combination of manual and random tests.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToInt_Random1">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToInt(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToDouble_Random1">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToDouble(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToDouble_Random2">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToDouble(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToDouble_Random3">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToDouble(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Advanced Software Engineering Tests</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.CommandTester">
|
||||
<summary>
|
||||
The CommandTester class tests the commands possible, mostly by getting a IVerb and checking it's description..
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.VerbFactoryTester_Automatic1">
|
||||
<summary>
|
||||
Automatically tests:
|
||||
- moveto
|
||||
- drawto
|
||||
- line
|
||||
- rp
|
||||
Current todo list:
|
||||
- square
|
||||
- rectangle
|
||||
- circle
|
||||
- triangle
|
||||
- dot
|
||||
- clear
|
||||
- pen
|
||||
- fill
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.MoveToTester_Manual1">
|
||||
<summary>
|
||||
tests the "move" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.MoveTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.MoveToTester_Manual2">
|
||||
<summary>
|
||||
tests the "moveto" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.MoveTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DrawToTester_Manual1">
|
||||
<summary>
|
||||
tests the "drawto" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.DrawTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DrawToTester_Manual2">
|
||||
<summary>
|
||||
tests the "line" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.DrawTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DrawToTester_Manual3">
|
||||
<summary>
|
||||
tests the "lineto" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.DrawTo"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual1">
|
||||
<summary>
|
||||
tests the "regularpolygon" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual2">
|
||||
<summary>
|
||||
tests the "rp" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual3">
|
||||
<summary>
|
||||
tests the "regularpolygon" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.RegularPolygonTester_Manual4">
|
||||
<summary>
|
||||
tests the "rp" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.RegularPolygon"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.SquareTester_Manual1">
|
||||
<summary>
|
||||
tests the "square" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Square"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.SquareTester_Manual2">
|
||||
<summary>
|
||||
tests the "square" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Square"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.CircleTester_Manual1">
|
||||
<summary>
|
||||
Tests the "circle" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Circle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.TriangleTester_Manual1">
|
||||
<summary>
|
||||
tests the "triangle" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Triangle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.TriangleTester_Manual2">
|
||||
<summary>
|
||||
tests the "triangle" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Triangle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.DotTester_Manual1">
|
||||
<summary>
|
||||
test the "dot" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Dot"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ClearTester_Manual1">
|
||||
<summary>
|
||||
tests the "clear" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.Circle"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ResetPenTester_Manual1">
|
||||
<summary>
|
||||
Tests the "reset" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.ResetPen"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ResetPenTester_Manual2">
|
||||
<summary>
|
||||
Tests the "resetpen" command. See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.ResetPen"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.PenTester_Manual1">
|
||||
<summary>
|
||||
Tests the command "pen". See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.PenColor"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.FillTester_Manual1">
|
||||
<summary>
|
||||
Tests the command "fill". See <see cref="T:Advanced_Software_Engineering.Verbs.DrawingVerbs.FillColor"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.IfTester_Manual1">
|
||||
<summary>
|
||||
Tests the "if" command. It hasn't been implemented yet.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.MethodTester_Manual1">
|
||||
<summary>
|
||||
Tests the "def" command. It hasn't been implemented yet.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.CommandTester.ValueTester_Manual1">
|
||||
<summary>
|
||||
Tests the "int" declaration and assignment. It hasn't been implemented yet.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.HelperFunctionsTester">
|
||||
<summary>
|
||||
This class tests <see cref="T:Advanced_Software_Engineering.HelperFunctions"/> methods. It uses a combination of manual and random tests.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.Strip_Random1">
|
||||
<summary>
|
||||
Random strip spaces test
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.Strip_Manual1">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.Strip(System.String)"/> test
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.Strip_Manual2">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.Strip(System.String)"/> test
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.StripStringArray_Manual1">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.StripStringArray(System.String[])"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.StripStringArray_Manual2">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.StripStringArray(System.String[])"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual1">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual2">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual3">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Manual4">
|
||||
<summary>
|
||||
Manual <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.HelperFunctionsTester.CommandAndParameterParser_Random1">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.HelperFunctions.CommandAndParameterParser(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.Properties.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Advanced_Software_Engineering_Tests.Properties.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Advanced_Software_Engineering_Tests.Properties.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Advanced_Software_Engineering_Tests.ValueHelperTester">
|
||||
<summary>
|
||||
This class tests <see cref="T:Advanced_Software_Engineering.Verbs.Value.ValueHelper"/> methods. It uses a combination of manual and random tests.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToInt_Random1">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToInt(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToDouble_Random1">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToDouble(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToDouble_Random2">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToDouble(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Advanced_Software_Engineering_Tests.ValueHelperTester.ConvertToDouble_Random3">
|
||||
<summary>
|
||||
Random <see cref="M:Advanced_Software_Engineering.Verbs.Value.ValueHelper.ConvertToDouble(System.String)"/> test.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
+445
-445
@@ -1,446 +1,446 @@
|
||||
using Advanced_Software_Engineering;
|
||||
using Advanced_Software_Engineering.Verbs.DrawingVerbs;
|
||||
using Advanced_Software_Engineering.Verbs.Value.ValueObjects;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests {
|
||||
|
||||
/// <summary>
|
||||
/// The CommandTester class tests the commands possible, mostly by getting a IVerb and checking it's description..
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class CommandTester {
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Automatically tests:
|
||||
/// - moveto
|
||||
/// - drawto
|
||||
/// - line
|
||||
/// - rp
|
||||
/// Current todo list:
|
||||
/// - square
|
||||
/// - rectangle
|
||||
/// - circle
|
||||
/// - triangle
|
||||
/// - dot
|
||||
/// - clear
|
||||
/// - pen
|
||||
/// - fill
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void VerbFactoryTester_Automatic1() {
|
||||
Dictionary<string, int[]> commandParamaterNumber = new Dictionary<string, int[]>
|
||||
{
|
||||
{"moveto", new int[] { 2 } },
|
||||
{"drawto", new int[] { 2 } },
|
||||
{"line", new int[] { 2 } },
|
||||
{"lineto", new int[] { 2 } },
|
||||
{"rp", new int[] { 2, 3 } },
|
||||
//todo:
|
||||
{"square", new int[] { 1, 2, 8 } },
|
||||
{"rectangle", new int[] { 1, 2, 6 } },
|
||||
{"circle", new int[] { 1 } },
|
||||
{"triangle", new int[] { 1, 2 } },
|
||||
{"dot", new int[] { 0 } },
|
||||
{"clear", new int[] { 0 } },
|
||||
{"pen", new int[] { 1, 3 } },
|
||||
{"fill", new int[] { 1, 3 } }
|
||||
};
|
||||
|
||||
foreach (string command in commandParamaterNumber.Keys) {
|
||||
foreach (int commandParameterNumbers in commandParamaterNumber[command]) {
|
||||
string input = command + " ";
|
||||
List<int> inputParameters = new List<int>();
|
||||
|
||||
for (int paramater = 0; paramater < commandParameterNumbers; paramater++) {
|
||||
int inputParameter = rand.Next(1000);
|
||||
inputParameters.Add(inputParameter);
|
||||
input += inputParameter + (paramater - 1 != commandParameterNumbers ? ", " : "");
|
||||
}
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
if (command == "moveto") {
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Move origin to " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
} else if (command == "drawto" || command == "lineto" || command == "line") {
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
} else if (command == "shape") {
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc;
|
||||
if (commandParameterNumbers == 2)
|
||||
correctDesc = "Draws a " + inputParameters[0] + " sided regular polygon, with rotation of 0 radians, with inner radius of " + (double)inputParameters[1];
|
||||
else
|
||||
correctDesc = "Draws a " + inputParameters[0] + " sided regular polygon, with rotation of " + (double)(Math.PI * inputParameters[2] / 180) + " radians, with inner radius of " + (double)inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "move" command. See <see cref="MoveTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void MoveToTester_Manual1() {
|
||||
string input = "move 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Move origin to " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "moveto" command. See <see cref="MoveTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void MoveToTester_Manual2() {
|
||||
string input = "moveto 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Move origin to " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "drawto" command. See <see cref="DrawTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DrawToTester_Manual1() {
|
||||
string input = "drawto 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "line" command. See <see cref="DrawTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DrawToTester_Manual2() {
|
||||
string input = "line 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "lineto" command. See <see cref="DrawTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DrawToTester_Manual3() {
|
||||
string input = "lineto 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "regularpolygon" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual1() {
|
||||
string input = "regularpolygon 3, 50";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 0;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "rp" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual2() {
|
||||
string input = "rp 3, 50";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 0;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "regularpolygon" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual3() {
|
||||
string input = "regularpolygon 3, 50, 25";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 25 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "rp" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual4() {
|
||||
string input = "rp 3, 50, 25";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 25 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "square" command. See <see cref="Square"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void SquareTester_Manual1() {
|
||||
string input = "square 500";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 4;
|
||||
double scale = 500;
|
||||
double offset = 0 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "square" command. See <see cref="Square"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void SquareTester_Manual2() {
|
||||
string input = "square 500, 45";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 4;
|
||||
double scale = 500;
|
||||
double offset = 45 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "circle" command. See <see cref="Circle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CircleTester_Manual1() {
|
||||
string input = "circle 100";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
string correctDesc = "Draws a circle radius " + 100d.ToString() + ", with origin of the pen";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "triangle" command. See <see cref="Triangle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void TriangleTester_Manual1() {
|
||||
string input = "triangle 500";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 500;
|
||||
double offset = 0 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "triangle" command. See <see cref="Triangle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void TriangleTester_Manual2() {
|
||||
string input = "triangle 500, 45";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 500;
|
||||
double offset = 45 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test the "dot" command. See <see cref="Dot"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DotTester_Manual1() {
|
||||
string input = "dot";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Places a dot where the pen currently is";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "clear" command. See <see cref="Circle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ClearTester_Manual1() {
|
||||
string input = "clear";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Clears the canvas";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "reset" command. See <see cref="ResetPen"/>
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ResetPenTester_Manual1() {
|
||||
string input = "reset";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Moves pen to the start (0, 0)";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "resetpen" command. See <see cref="ResetPen"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ResetPenTester_Manual2() {
|
||||
string input = "resetpen";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Moves pen to the start (0, 0)";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the command "pen". See <see cref="PenColor"/>
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void PenTester_Manual1() {
|
||||
string input = "pen red";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Set pen color to: Color [Red]";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the command "fill". See <see cref="FillColor"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void FillTester_Manual1() {
|
||||
string input = "fill pink";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Set fill color to: Color [Pink]";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "if" command. It hasn't been implemented yet.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void IfTester_Manual1() {
|
||||
string input = "if i == 10";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Tests if variable 'i' is equal to 10";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "def" command. It hasn't been implemented yet.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void MethodTester_Manual1() {
|
||||
string input = "def duck, int i";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Create a new method called 'duck' with input 'int i'. The method: ";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "int" declaration and assignment. It hasn't been implemented yet.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ValueTester_Manual1() {
|
||||
string input = "int i = 10";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Declares and sets integer 'i' to '10'";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
}
|
||||
using Advanced_Software_Engineering;
|
||||
using Advanced_Software_Engineering.Verbs.DrawingVerbs;
|
||||
using Advanced_Software_Engineering.Verbs.Value.ValueObjects;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests {
|
||||
|
||||
/// <summary>
|
||||
/// The CommandTester class tests the commands possible, mostly by getting a IVerb and checking it's description..
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class CommandTester {
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Automatically tests:
|
||||
/// - moveto
|
||||
/// - drawto
|
||||
/// - line
|
||||
/// - rp
|
||||
/// Current todo list:
|
||||
/// - square
|
||||
/// - rectangle
|
||||
/// - circle
|
||||
/// - triangle
|
||||
/// - dot
|
||||
/// - clear
|
||||
/// - pen
|
||||
/// - fill
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void VerbFactoryTester_Automatic1() {
|
||||
Dictionary<string, int[]> commandParamaterNumber = new Dictionary<string, int[]>
|
||||
{
|
||||
{"moveto", new int[] { 2 } },
|
||||
{"drawto", new int[] { 2 } },
|
||||
{"line", new int[] { 2 } },
|
||||
{"lineto", new int[] { 2 } },
|
||||
{"rp", new int[] { 2, 3 } },
|
||||
//todo:
|
||||
{"square", new int[] { 1, 2, 8 } },
|
||||
{"rectangle", new int[] { 1, 2, 6 } },
|
||||
{"circle", new int[] { 1 } },
|
||||
{"triangle", new int[] { 1, 2 } },
|
||||
{"dot", new int[] { 0 } },
|
||||
{"clear", new int[] { 0 } },
|
||||
{"pen", new int[] { 1, 3 } },
|
||||
{"fill", new int[] { 1, 3 } }
|
||||
};
|
||||
|
||||
foreach (string command in commandParamaterNumber.Keys) {
|
||||
foreach (int commandParameterNumbers in commandParamaterNumber[command]) {
|
||||
string input = command + " ";
|
||||
List<int> inputParameters = new List<int>();
|
||||
|
||||
for (int paramater = 0; paramater < commandParameterNumbers; paramater++) {
|
||||
int inputParameter = rand.Next(1000);
|
||||
inputParameters.Add(inputParameter);
|
||||
input += inputParameter + (paramater - 1 != commandParameterNumbers ? ", " : "");
|
||||
}
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
if (command == "moveto") {
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Move origin to " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
} else if (command == "drawto" || command == "lineto" || command == "line") {
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
} else if (command == "shape") {
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc;
|
||||
if (commandParameterNumbers == 2)
|
||||
correctDesc = "Draws a " + inputParameters[0] + " sided regular polygon, with rotation of 0 radians, with inner radius of " + (double)inputParameters[1];
|
||||
else
|
||||
correctDesc = "Draws a " + inputParameters[0] + " sided regular polygon, with rotation of " + (double)(Math.PI * inputParameters[2] / 180) + " radians, with inner radius of " + (double)inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "move" command. See <see cref="MoveTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void MoveToTester_Manual1() {
|
||||
string input = "move 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Move origin to " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "moveto" command. See <see cref="MoveTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void MoveToTester_Manual2() {
|
||||
string input = "moveto 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Move origin to " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "drawto" command. See <see cref="DrawTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DrawToTester_Manual1() {
|
||||
string input = "drawto 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "line" command. See <see cref="DrawTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DrawToTester_Manual2() {
|
||||
string input = "line 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "lineto" command. See <see cref="DrawTo"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DrawToTester_Manual3() {
|
||||
string input = "lineto 200, 300";
|
||||
string[] inputParameters = { "200", "300" };
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Draw line " + inputParameters[0] + ", " + inputParameters[1];
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "regularpolygon" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual1() {
|
||||
string input = "regularpolygon 3, 50";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 0;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "rp" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual2() {
|
||||
string input = "rp 3, 50";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 0;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "regularpolygon" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual3() {
|
||||
string input = "regularpolygon 3, 50, 25";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 25 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "rp" command. See <see cref="RegularPolygon"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void RegularPolygonTester_Manual4() {
|
||||
string input = "rp 3, 50, 25";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 50;
|
||||
double offset = 25 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "square" command. See <see cref="Square"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void SquareTester_Manual1() {
|
||||
string input = "square 500";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 4;
|
||||
double scale = 500;
|
||||
double offset = 0 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "square" command. See <see cref="Square"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void SquareTester_Manual2() {
|
||||
string input = "square 500, 45";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 4;
|
||||
double scale = 500;
|
||||
double offset = 45 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "circle" command. See <see cref="Circle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CircleTester_Manual1() {
|
||||
string input = "circle 100";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
string correctDesc = "Draws a circle radius " + 100d.ToString() + ", with origin of the pen";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "triangle" command. See <see cref="Triangle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void TriangleTester_Manual1() {
|
||||
string input = "triangle 500";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 500;
|
||||
double offset = 0 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "triangle" command. See <see cref="Triangle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void TriangleTester_Manual2() {
|
||||
string input = "triangle 500, 45";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
|
||||
int sides = 3;
|
||||
double scale = 500;
|
||||
double offset = 45 * Math.PI / 180;
|
||||
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test the "dot" command. See <see cref="Dot"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void DotTester_Manual1() {
|
||||
string input = "dot";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Places a dot where the pen currently is";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tests the "clear" command. See <see cref="Circle"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ClearTester_Manual1() {
|
||||
string input = "clear";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Clears the canvas";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "reset" command. See <see cref="ResetPen"/>
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ResetPenTester_Manual1() {
|
||||
string input = "reset";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Moves pen to the start (0, 0)";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "resetpen" command. See <see cref="ResetPen"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ResetPenTester_Manual2() {
|
||||
string input = "resetpen";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Moves pen to the start (0, 0)";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the command "pen". See <see cref="PenColor"/>
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void PenTester_Manual1() {
|
||||
string input = "pen red";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Set pen color to: Color [Red]";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the command "fill". See <see cref="FillColor"/>.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void FillTester_Manual1() {
|
||||
string input = "fill pink";
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Set fill color to: Color [Pink]";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "if" command. It hasn't been implemented yet.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void IfTester_Manual1() {
|
||||
string input = "if i == 10";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Tests if variable 'i' is equal to 10";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "def" command. It hasn't been implemented yet.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void MethodTester_Manual1() {
|
||||
string input = "def duck, int i";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Create a new method called 'duck' with input 'int i'. The method: ";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the "int" declaration and assignment. It hasn't been implemented yet.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ValueTester_Manual1() {
|
||||
string input = "int i = 10";
|
||||
|
||||
IVerb IVerb = VerbFactory.MakeVerb(null, input);
|
||||
string verbDesc = IVerb.GetDescription();
|
||||
string correctDesc = "Declares and sets integer 'i' to '10'";
|
||||
|
||||
Assert.AreEqual(correctDesc, verbDesc);
|
||||
}
|
||||
}
|
||||
}
|
||||
+168
-168
@@ -1,169 +1,169 @@
|
||||
using Advanced_Software_Engineering;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests {
|
||||
|
||||
/// <summary>
|
||||
/// This class tests <see cref="HelperFunctions"/> methods. It uses a combination of manual and random tests.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class HelperFunctionsTester {
|
||||
private readonly string alphabet = "abcdefghijklmnopqrstuvwxzy";
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Random strip spaces test
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void Strip_Random1() {
|
||||
for (int test = 0; test < 200; test++) {
|
||||
int until = rand.Next(50);
|
||||
string correctOutput = "";
|
||||
|
||||
for (int i = 0; i < until; i++) {
|
||||
correctOutput += alphabet[rand.Next(alphabet.Length)];
|
||||
}
|
||||
|
||||
string obfuscatedInput = correctOutput;
|
||||
|
||||
obfuscatedInput = RandomSpaces() + obfuscatedInput + RandomSpaces();
|
||||
|
||||
Assert.AreEqual(correctOutput, HelperFunctions.Strip(obfuscatedInput));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.Strip(string)"/> test
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void Strip_Manual1() {
|
||||
string input = " a simple sentence surrounded by spaces ";
|
||||
string expected = "a simple sentence surrounded by spaces";
|
||||
|
||||
Assert.AreEqual(expected, HelperFunctions.Strip(input));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.Strip(string)"/> test
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void Strip_Manual2() {
|
||||
string input = " a simple sentence surrounded by spaces ";
|
||||
string expected = "a simple sentence surrounded by spaces";
|
||||
|
||||
Assert.AreEqual(expected, HelperFunctions.Strip(input));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.StripStringArray(string[])"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void StripStringArray_Manual1() {
|
||||
string[] input = { " ", " a ", " test", "t", "asdf ", "" };
|
||||
string[] expected = (new List<string> { "a", "test", "t", "asdf" }).ToArray();
|
||||
|
||||
int i = 0;
|
||||
foreach (string s in HelperFunctions.StripStringArray(input)) {
|
||||
Assert.AreEqual(expected[i++], s);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.StripStringArray(string[])"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void StripStringArray_Manual2() {
|
||||
string[] input = "a simple sentence surrounded by spaces".Split(" "[0]);
|
||||
string[] expected = (new List<string> { "a", "simple", "sentence", "surrounded", "by", "spaces" }).ToArray();
|
||||
|
||||
int i = 0;
|
||||
foreach (string s in HelperFunctions.StripStringArray(input)) {
|
||||
Assert.AreEqual(expected[i++], s);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual1() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser("moveto 200, 200");
|
||||
Assert.AreEqual("moveto", commands.GetCommand());
|
||||
Assert.AreEqual("200", commands.GetParameters()[0]);
|
||||
Assert.AreEqual("200", commands.GetParameters()[1]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual2() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser("clear");
|
||||
Assert.AreEqual("clear", commands.GetCommand());
|
||||
Assert.IsTrue(commands.GetParameters() == null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual3() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser("");
|
||||
Assert.IsTrue(commands == null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual4() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser(" genericCommand 2, 3,4 5");
|
||||
|
||||
Assert.AreEqual("genericCommand", commands.GetCommand());
|
||||
|
||||
string[] parameters = commands.GetParameters();
|
||||
|
||||
Assert.AreEqual("2", parameters[0]);
|
||||
Assert.AreEqual("3", parameters[1]);
|
||||
Assert.AreEqual("4 5", parameters[2]);
|
||||
}
|
||||
|
||||
private string RandomSpaces() {
|
||||
string spaces = " ";
|
||||
for (int i = 0; i < 50; i++) spaces += " ";
|
||||
return spaces;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Random1() {
|
||||
string[] randomCommands = { "test", "moveto", "lineto", "markiplier", "clear", "shape", "etc" };
|
||||
|
||||
for (int test = 0; test < 10000; test++) {
|
||||
string command = randomCommands[rand.Next(randomCommands.Length)];
|
||||
string input = RandomSpaces() + command;
|
||||
|
||||
List<string> parameters = new List<string>();
|
||||
for (int parameterI = 0; parameterI < rand.Next(99) + 1; parameterI++) {
|
||||
string parameter = (rand.NextDouble() * rand.Next(-1000, 1000)).ToString();
|
||||
parameters.Add(parameter);
|
||||
input += RandomSpaces() + parameter + RandomSpaces() + "," + RandomSpaces();
|
||||
}
|
||||
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser(input);
|
||||
|
||||
Assert.AreEqual(command, commands.GetCommand());
|
||||
|
||||
int i = 0;
|
||||
foreach (string expected in parameters) {
|
||||
Assert.AreEqual(expected, commands.GetParameters()[i++]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using Advanced_Software_Engineering;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests {
|
||||
|
||||
/// <summary>
|
||||
/// This class tests <see cref="HelperFunctions"/> methods. It uses a combination of manual and random tests.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class HelperFunctionsTester {
|
||||
private readonly string alphabet = "abcdefghijklmnopqrstuvwxzy";
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Random strip spaces test
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void Strip_Random1() {
|
||||
for (int test = 0; test < 200; test++) {
|
||||
int until = rand.Next(50);
|
||||
string correctOutput = "";
|
||||
|
||||
for (int i = 0; i < until; i++) {
|
||||
correctOutput += alphabet[rand.Next(alphabet.Length)];
|
||||
}
|
||||
|
||||
string obfuscatedInput = correctOutput;
|
||||
|
||||
obfuscatedInput = RandomSpaces() + obfuscatedInput + RandomSpaces();
|
||||
|
||||
Assert.AreEqual(correctOutput, HelperFunctions.Strip(obfuscatedInput));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.Strip(string)"/> test
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void Strip_Manual1() {
|
||||
string input = " a simple sentence surrounded by spaces ";
|
||||
string expected = "a simple sentence surrounded by spaces";
|
||||
|
||||
Assert.AreEqual(expected, HelperFunctions.Strip(input));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.Strip(string)"/> test
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void Strip_Manual2() {
|
||||
string input = " a simple sentence surrounded by spaces ";
|
||||
string expected = "a simple sentence surrounded by spaces";
|
||||
|
||||
Assert.AreEqual(expected, HelperFunctions.Strip(input));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.StripStringArray(string[])"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void StripStringArray_Manual1() {
|
||||
string[] input = { " ", " a ", " test", "t", "asdf ", "" };
|
||||
string[] expected = (new List<string> { "a", "test", "t", "asdf" }).ToArray();
|
||||
|
||||
int i = 0;
|
||||
foreach (string s in HelperFunctions.StripStringArray(input)) {
|
||||
Assert.AreEqual(expected[i++], s);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.StripStringArray(string[])"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void StripStringArray_Manual2() {
|
||||
string[] input = "a simple sentence surrounded by spaces".Split(" "[0]);
|
||||
string[] expected = (new List<string> { "a", "simple", "sentence", "surrounded", "by", "spaces" }).ToArray();
|
||||
|
||||
int i = 0;
|
||||
foreach (string s in HelperFunctions.StripStringArray(input)) {
|
||||
Assert.AreEqual(expected[i++], s);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual1() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser("moveto 200, 200");
|
||||
Assert.AreEqual("moveto", commands.GetCommand());
|
||||
Assert.AreEqual("200", commands.GetParameters()[0]);
|
||||
Assert.AreEqual("200", commands.GetParameters()[1]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual2() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser("clear");
|
||||
Assert.AreEqual("clear", commands.GetCommand());
|
||||
Assert.IsTrue(commands.GetParameters() == null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual3() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser("");
|
||||
Assert.IsTrue(commands == null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manual <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Manual4() {
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser(" genericCommand 2, 3,4 5");
|
||||
|
||||
Assert.AreEqual("genericCommand", commands.GetCommand());
|
||||
|
||||
string[] parameters = commands.GetParameters();
|
||||
|
||||
Assert.AreEqual("2", parameters[0]);
|
||||
Assert.AreEqual("3", parameters[1]);
|
||||
Assert.AreEqual("4 5", parameters[2]);
|
||||
}
|
||||
|
||||
private string RandomSpaces() {
|
||||
string spaces = " ";
|
||||
for (int i = 0; i < 50; i++) spaces += " ";
|
||||
return spaces;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="HelperFunctions.CommandAndParameterParser(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void CommandAndParameterParser_Random1() {
|
||||
string[] randomCommands = { "test", "moveto", "lineto", "markiplier", "clear", "shape", "etc" };
|
||||
|
||||
for (int test = 0; test < 10000; test++) {
|
||||
string command = randomCommands[rand.Next(randomCommands.Length)];
|
||||
string input = RandomSpaces() + command;
|
||||
|
||||
List<string> parameters = new List<string>();
|
||||
for (int parameterI = 0; parameterI < rand.Next(99) + 1; parameterI++) {
|
||||
string parameter = (rand.NextDouble() * rand.Next(-1000, 1000)).ToString();
|
||||
parameters.Add(parameter);
|
||||
input += RandomSpaces() + parameter + RandomSpaces() + "," + RandomSpaces();
|
||||
}
|
||||
|
||||
CommandAndParameterParserResult commands = HelperFunctions.CommandAndParameterParser(input);
|
||||
|
||||
Assert.AreEqual(command, commands.GetCommand());
|
||||
|
||||
int i = 0;
|
||||
foreach (string expected in parameters) {
|
||||
Assert.AreEqual(expected, commands.GetParameters()[i++]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+63
-63
@@ -1,63 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Advanced_Software_Engineering_Tests.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Advanced_Software_Engineering_Tests.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+100
-100
@@ -1,101 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+65
-65
@@ -1,66 +1,66 @@
|
||||
using Advanced_Software_Engineering.Verbs.Value;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests {
|
||||
|
||||
/// <summary>
|
||||
/// This class tests <see cref="ValueHelper"/> methods. It uses a combination of manual and random tests.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
internal class ValueHelperTester {
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToInt(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToInt_Random1() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
int expected = rand.Next(int.MinValue, int.MaxValue);
|
||||
string input = expected.ToString();
|
||||
|
||||
Assert.AreEqual(expected, ValueHelper.ConvertToInt(input));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToDouble(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToDouble_Random1() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
double expected = rand.NextDouble();
|
||||
string input = expected.ToString();
|
||||
|
||||
Assert.AreEqual(expected, ValueHelper.ConvertToDouble(input));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToDouble(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToDouble_Random2() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
double expected = rand.Next(100, 100) * rand.NextDouble();
|
||||
string input = expected.ToString();
|
||||
|
||||
Assert.AreEqual(expected, ValueHelper.ConvertToDouble(input));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToDouble(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToDouble_Random3() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
int expected = rand.Next(100, 100);
|
||||
string input = ((double)expected).ToString();
|
||||
|
||||
Assert.AreEqual((double)expected, ValueHelper.ConvertToDouble(input));
|
||||
}
|
||||
}
|
||||
}
|
||||
using Advanced_Software_Engineering.Verbs.Value;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
|
||||
namespace Advanced_Software_Engineering_Tests {
|
||||
|
||||
/// <summary>
|
||||
/// This class tests <see cref="ValueHelper"/> methods. It uses a combination of manual and random tests.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
internal class ValueHelperTester {
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToInt(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToInt_Random1() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
int expected = rand.Next(int.MinValue, int.MaxValue);
|
||||
string input = expected.ToString();
|
||||
|
||||
Assert.AreEqual(expected, ValueHelper.ConvertToInt(input));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToDouble(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToDouble_Random1() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
double expected = rand.NextDouble();
|
||||
string input = expected.ToString();
|
||||
|
||||
Assert.AreEqual(expected, ValueHelper.ConvertToDouble(input));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToDouble(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToDouble_Random2() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
double expected = rand.Next(100, 100) * rand.NextDouble();
|
||||
string input = expected.ToString();
|
||||
|
||||
Assert.AreEqual(expected, ValueHelper.ConvertToDouble(input));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Random <see cref="ValueHelper.ConvertToDouble(string)"/> test.
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void ConvertToDouble_Random3() {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
int expected = rand.Next(100, 100);
|
||||
string input = ((double)expected).ToString();
|
||||
|
||||
Assert.AreEqual((double)expected, ValueHelper.ConvertToDouble(input));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user