Private
Public Access
Changed unit test settings
This commit is contained in:
1 parent
8a17d77510
commit
54de63eeb3
6 files changed
+208
-10
No files matched your search
+19
-1
@@ -1,10 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>Advanced_Software_Engineering_Tests</RootNamespace>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<OutputType>WinExe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -12,10 +14,26 @@
|
||||
<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>
|
||||
Generated
+63
@@ -0,0 +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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +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>
|
||||
</root>
|
||||
+3
-3
@@ -12,7 +12,7 @@ namespace Advanced_Software_Engineering_Tests {
|
||||
Random rand = new Random();
|
||||
|
||||
[TestMethod]
|
||||
public void TestStrip_Random1() {
|
||||
public void Strip_Random1() {
|
||||
|
||||
for (int test = 0; test < 200; test++) {
|
||||
int until = rand.Next(50);
|
||||
@@ -32,7 +32,7 @@ namespace Advanced_Software_Engineering_Tests {
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestStrip_Manual1() {
|
||||
public void Strip_Manual1() {
|
||||
string input = " a simple sentence surrounded by spaces ";
|
||||
string expected = "a simple sentence surrounded by spaces";
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Advanced_Software_Engineering_Tests {
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestStrip_Manual2() {
|
||||
public void Strip_Manual2() {
|
||||
string input = " a simple sentence surrounded by spaces ";
|
||||
string expected = "a simple sentence surrounded by spaces";
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Advanced_Software_Engineering {
|
||||
string GetDescription();
|
||||
}
|
||||
|
||||
class MoveTo : Verb {
|
||||
public class MoveTo : Verb {
|
||||
|
||||
protected Drawer drawer;
|
||||
protected Point moveToPoint;
|
||||
@@ -109,7 +109,7 @@ namespace Advanced_Software_Engineering {
|
||||
|
||||
}
|
||||
|
||||
class DrawTo : Verb {
|
||||
public class DrawTo : Verb {
|
||||
protected Drawer drawer;
|
||||
protected Point moveToPoint;
|
||||
|
||||
|
||||
@@ -3,10 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Advanced_Software_Engineering {
|
||||
class Commander {
|
||||
public class Commander {
|
||||
|
||||
Graphics graphics;
|
||||
List<Verb> commands = new List<Verb>();
|
||||
@@ -28,6 +27,10 @@ namespace Advanced_Software_Engineering {
|
||||
drawer.ResetDrawer();
|
||||
}
|
||||
|
||||
public Commander(string command) {
|
||||
Console.WriteLine("Warning! No graphics context!!!");
|
||||
}
|
||||
|
||||
public Commander(Graphics graphics, string rawCommands) {
|
||||
this.graphics = graphics;
|
||||
this.drawer = new Drawer(this.graphics);
|
||||
@@ -61,14 +64,19 @@ namespace Advanced_Software_Engineering {
|
||||
Console.WriteLine(verb.GetDescription());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine("Error: Unknown error.");
|
||||
|
||||
try {
|
||||
new ErrorWindow(
|
||||
"Unexpected error parsing commands",
|
||||
"The program phraser has encountered an undexpected error." + Environment.NewLine,
|
||||
e.Message + Environment.NewLine + e.StackTrace,
|
||||
ErrorWindow.ERROR_MESSAGE
|
||||
).Show();
|
||||
|
||||
}
|
||||
catch(Exception windowError) {
|
||||
Console.WriteLine("Failed to display error window!");
|
||||
}
|
||||
RemoveAllCommands();
|
||||
}
|
||||
}
|
||||
@@ -87,9 +95,17 @@ namespace Advanced_Software_Engineering {
|
||||
drawer.ResetDrawer();
|
||||
}
|
||||
|
||||
public string ExplainCommands() {
|
||||
string desc = "";
|
||||
foreach(Verb command in commands) {
|
||||
desc += command.GetDescription() + Environment.NewLine;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
class Drawer {
|
||||
}
|
||||
|
||||
public class Drawer {
|
||||
protected static Color defaultColor = Color.Black;
|
||||
protected static float defaultWidth = 1f;
|
||||
protected bool fill = false;
|
||||
|
||||
Reference in new issue
Block a user