diff --git a/Diplomatic.Android/Diplomatic.Droid.csproj b/Diplomatic.Android/Diplomatic.Droid.csproj index 24b5877..e3cba95 100644 --- a/Diplomatic.Android/Diplomatic.Droid.csproj +++ b/Diplomatic.Android/Diplomatic.Droid.csproj @@ -79,12 +79,6 @@ - - - - - - @@ -117,4 +111,4 @@ - \ No newline at end of file + diff --git a/Diplomatic.Android/Resources/drawable/donaldtrump.png b/Diplomatic.Android/Resources/drawable/donaldtrump.png deleted file mode 100644 index 309c9c1..0000000 Binary files a/Diplomatic.Android/Resources/drawable/donaldtrump.png and /dev/null differ diff --git a/Diplomatic.Android/Resources/drawable/employee.png b/Diplomatic.Android/Resources/drawable/employee.png deleted file mode 100644 index f402bd6..0000000 Binary files a/Diplomatic.Android/Resources/drawable/employee.png and /dev/null differ diff --git a/Diplomatic.Android/Resources/drawable/gavinbelson.png b/Diplomatic.Android/Resources/drawable/gavinbelson.png deleted file mode 100644 index 4a321f8..0000000 Binary files a/Diplomatic.Android/Resources/drawable/gavinbelson.png and /dev/null differ diff --git a/Diplomatic.Android/Resources/drawable/good_effort.png b/Diplomatic.Android/Resources/drawable/good_effort.png deleted file mode 100644 index da0ff19..0000000 Binary files a/Diplomatic.Android/Resources/drawable/good_effort.png and /dev/null differ diff --git a/Diplomatic.Android/Resources/drawable/harrypotter.png b/Diplomatic.Android/Resources/drawable/harrypotter.png deleted file mode 100644 index 5aa487a..0000000 Binary files a/Diplomatic.Android/Resources/drawable/harrypotter.png and /dev/null differ diff --git a/Diplomatic.Android/Resources/drawable/student.png b/Diplomatic.Android/Resources/drawable/student.png deleted file mode 100644 index 84353ed..0000000 Binary files a/Diplomatic.Android/Resources/drawable/student.png and /dev/null differ diff --git a/Diplomatic.Android/Resources/drawable/waltdisney.png b/Diplomatic.Android/Resources/drawable/waltdisney.png deleted file mode 100644 index e698b1d..0000000 Binary files a/Diplomatic.Android/Resources/drawable/waltdisney.png and /dev/null differ diff --git a/Diplomatic.Core/Classes/Field.cs b/Diplomatic.Core/Classes/Field.cs deleted file mode 100644 index ee9cce7..0000000 --- a/Diplomatic.Core/Classes/Field.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Newtonsoft.Json; -using System; - -namespace Diplomatic.Core -{ - [Serializable] - public class Field - { - [JsonProperty("name")] - public string Name { get; } - [JsonIgnore] - public string Value { get; set; } - - public Field(string name) - { - Name = name; - Value = ""; - } - } -} diff --git a/Diplomatic.Core/Classes/Template.cs b/Diplomatic.Core/Classes/Template.cs deleted file mode 100644 index bf670ca..0000000 --- a/Diplomatic.Core/Classes/Template.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace Diplomatic.Core -{ - [Serializable] - public class Template - { - [JsonProperty("name")] - public string TemplateName { get; set; } - [JsonProperty("path")] - public string Path { get; set; } - [JsonProperty("fields")] - public IEnumerable Fields { get; set; } - - public Template(string name, string path, IEnumerable fields) - { - TemplateName = name; - Path = path; - Fields = fields; - } - } -} diff --git a/Diplomatic.Core/Diplomatic.Core.csproj b/Diplomatic.Core/Diplomatic.Core.csproj deleted file mode 100644 index a012065..0000000 --- a/Diplomatic.Core/Diplomatic.Core.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netstandard2.0 - - - - 7.2 - - - - 7.2 - - - - - - - - diff --git a/Diplomatic.Tests/Diplomatic.Tests.csproj b/Diplomatic.Tests/Diplomatic.Tests.csproj index a2824a8..62b4fa9 100644 --- a/Diplomatic.Tests/Diplomatic.Tests.csproj +++ b/Diplomatic.Tests/Diplomatic.Tests.csproj @@ -43,167 +43,10 @@ 4 - - ..\packages\Castle.Core.4.3.0\lib\net45\Castle.Core.dll - - - ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll - True - - - ..\packages\Moq.4.8.3\lib\net45\Moq.dll - ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - - ..\packages\SixLabors.Core.1.0.0-beta0005\lib\netstandard1.1\SixLabors.Core.dll - - - ..\packages\SixLabors.Fonts.1.0.0-beta0005\lib\netstandard2.0\SixLabors.Fonts.dll - - - ..\packages\SixLabors.ImageSharp.1.0.0-beta0004\lib\netstandard2.0\SixLabors.ImageSharp.dll - - - ..\packages\SixLabors.ImageSharp.Drawing.1.0.0-beta0004\lib\netstandard2.0\SixLabors.ImageSharp.Drawing.dll - - - ..\packages\SixLabors.Shapes.1.0.0-beta0005\lib\netstandard2.0\SixLabors.Shapes.dll - - - ..\packages\SixLabors.Shapes.Text.1.0.0-beta0005\lib\netstandard2.0\SixLabors.Shapes.Text.dll - - - ..\packages\SkiaSharp.1.60.1\lib\net45\SkiaSharp.dll - - - - ..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll - True - - - ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll - - - ..\packages\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll - - - - ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll - True - - - - ..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll - - - ..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll - True - True - - - ..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll - True - - - ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll - True - - - ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll - True - True - - - - ..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll - True - - - ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll - True - - - ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll - True - - - ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll - True - - - ..\packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll - True - - - ..\packages\System.Memory.4.5.0-rc1\lib\netstandard2.0\System.Memory.dll - - - ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll - True - True - - - ..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll - True - True - - - - ..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll - True - - - ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll - True - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0-rc1\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll - - - ..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll - True - - - ..\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll - True - - - ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - True - - - ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll - True - True - - - ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll - True - - - ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll - True - - - ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll - True - - - ..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll - True - - - ..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll - - - ..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll - ..\packages\Xamarin.Forms.3.0.0.482510\lib\netstandard2.0\Xamarin.Forms.Core.dll @@ -213,12 +56,6 @@ ..\packages\Xamarin.Forms.3.0.0.482510\lib\netstandard2.0\Xamarin.Forms.Xaml.dll - - - - ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll - True - ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll @@ -238,9 +75,6 @@ - - - diff --git a/Diplomatic.Tests/FieldTest.cs b/Diplomatic.Tests/FieldTest.cs index e8ebf33..f098d00 100644 --- a/Diplomatic.Tests/FieldTest.cs +++ b/Diplomatic.Tests/FieldTest.cs @@ -1,41 +1,31 @@ -using Diplomatic.Core; using Newtonsoft.Json; using Xunit; namespace Diplomatic.Tests { + using Models; public class FieldTest { - readonly Field subject; - readonly string serialized; + private readonly Field subject; + private readonly string serialized; public FieldTest() { - subject = new Field("Test field", 1, 2, 3, 4); - serialized = @"{ - ""Name"":""Test field"", - ""XOffset"":1, - ""YOffset"":2, - ""Height"":3, - ""Width"":4 - }"; + subject = new Field("Test field"); + serialized = @"{""name"":""Test field""}"; } [Fact] public void FieldSerializesToJSON() { - var output = JsonConvert.SerializeObject(subject); - Assert.Contains("Name", output); - Assert.Contains("XOffset", output); - Assert.Contains("YOffset", output); - Assert.Contains("Width", output); - Assert.Contains("Height", output); + string output = JsonConvert.SerializeObject(subject); + Assert.Contains("name", output); } [Fact] public void FieldDeserializesFromJSON() { - var field = JsonConvert.DeserializeObject(serialized); + Field field = JsonConvert.DeserializeObject(serialized); Assert.Equal("Test field", field.Name); } @@ -52,15 +42,5 @@ public void FilledFieldIsValid() subject.Value = "test"; Assert.True(subject.IsValid); } - - [Fact] - public void DestructuresWithTupleAssignment() - { - (var x, var y, var w, var h) = subject; - Assert.Equal(1, x); - Assert.Equal(2, y); - Assert.Equal(3, w); - Assert.Equal(4, h); - } } } diff --git a/Diplomatic.Tests/ResourceLoaderTest.cs b/Diplomatic.Tests/ResourceLoaderTest.cs index 27b5c2c..05d730a 100644 --- a/Diplomatic.Tests/ResourceLoaderTest.cs +++ b/Diplomatic.Tests/ResourceLoaderTest.cs @@ -17,7 +17,7 @@ public class LoadText public void CanLoadText() { // TODO: Fix dependency on actual file existence - string resource = "templates.json"; + string resource = "Images.test.png"; var loader = new ResourceLoader(); string result = loader.LoadText(resource); @@ -52,7 +52,7 @@ public class LoadTextAsync public async Task CanLoadText() { // TODO: Fix dependency on actual file existence - string resource = "templates.json"; + string resource = "Images.test.png"; var loader = new ResourceLoader(); string result = await loader.LoadTextAsync(resource); @@ -118,7 +118,7 @@ public class LoadBinary public void CanLoadBinary() { // TODO: Fix dependency on actual file existence - string resource = "templates.json"; + string resource = "Images.test.png"; var loader = new ResourceLoader(); byte[] bytes = loader.LoadBinary(resource).ToArray(); @@ -150,7 +150,7 @@ public class LoadBinaryAsync public async Task CanLoadBinary() { // TODO: Fix dependency on actual file existence - string resource = "templates.json"; + string resource = "Images.test.png"; var loader = new ResourceLoader(); byte[] bytes = (await loader.LoadBinaryAsync(resource)).ToArray(); diff --git a/Diplomatic.Tests/TemplateTest.cs b/Diplomatic.Tests/TemplateTest.cs index 3bbb307..1c1e834 100644 --- a/Diplomatic.Tests/TemplateTest.cs +++ b/Diplomatic.Tests/TemplateTest.cs @@ -1,76 +1,54 @@ -using Diplomatic.Core; -using Moq; -using Newtonsoft.Json; -using System.IO; using System.Linq; +using Newtonsoft.Json; using Xunit; namespace Diplomatic.Tests { + using Models; public class TemplateTest { - readonly IField[] ValidFields; - readonly ITemplateStream ValidStream; - Template subject; + private readonly Field[] validFields; + private readonly Field[] invalidFields; + private Template subject; public TemplateTest() { - var mockField = new Mock(); - mockField.Setup(field => field.IsValid).Returns(true); - ValidFields = new IField[] { mockField.Object }; + var validField = new Field("Valid"); + validField.Value = "non-empty"; + validFields = new Field[] { validField }; - var mockStream = new Mock(); - mockStream.Setup(stream => stream.IsValid).Returns(true); - ValidStream = mockStream.Object; + var invalidField = new Field("Invalid"); + invalidFields = new Field[] { invalidField }; } [Fact] public void ValidatesFieldsAreFilled() { - subject = new Template("Template with filled fields", ValidStream, ValidFields); - Assert.True(subject.IsValid); - } - - [Fact] - public void NotValidWithoutFields() - { - Template subject = new Template("Template with no fields", ValidStream, new Field[] { }); + subject = new Template(true, invalidFields); Assert.False(subject.IsValid); - } - [Fact] - public void NotValidWithoutStream() - { - var mockStream = new Mock(); - mockStream.Setup(stream => stream.IsValid).Returns(false); - var badStream = mockStream.Object; - - Template subject = new Template("Test template", badStream, ValidFields); - - Assert.False(subject.IsValid); + subject = new Template(true, validFields); + Assert.True(subject.IsValid); } [Fact] public void DeserializesFromJSON() { - var serialized = @"{ - ""FilePath"":""testFile.pdf"", - ""TemplateName"":""Diploma"", - ""Fields"":[]}"; - var subject = JsonConvert.DeserializeObject