Skip to content

Commit

Permalink
Migrated the project to .net core.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvydas Sidorenko committed Sep 27, 2016
1 parent e25a5da commit 094c099
Show file tree
Hide file tree
Showing 19 changed files with 176 additions and 318 deletions.
20 changes: 10 additions & 10 deletions EpubSharp.Tests/EpubBookTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;

namespace EpubSharp.Tests
{
[TestClass]
[TestFixture]
public class EpubBookTests
{
[TestMethod]
[Test]
public void EpubAsPlainTextTest1()
{
var book = EpubReader.Read(@"../../Samples/epub-assorted/boothbyg3249432494-8epub.epub");
//File.WriteAllText("../../Samples/epub-assorted/boothbyg3249432494-8epub.txt", book.ToPlainText());
var book = EpubReader.Read(@"Samples/epub-assorted/boothbyg3249432494-8epub.epub");
//File.WriteAllText("Samples/epub-assorted/boothbyg3249432494-8epub.txt", book.ToPlainText());

Func<string, string> normalize = text => text.Replace("\r", "").Replace("\n", "").Replace(" ", "");
var expected = File.ReadAllText(@"../../Samples/epub-assorted/boothbyg3249432494-8epub.txt");
var expected = File.ReadAllText(@"Samples/epub-assorted/boothbyg3249432494-8epub.txt");
var actual = book.ToPlainText();
Assert.AreEqual(normalize(expected), normalize(actual));

Expand All @@ -40,14 +40,14 @@ public void EpubAsPlainTextTest1()
Assert.IsNotNull(lines.SingleOrDefault(e => e == "XVII. KAPITEL."));
}

[TestMethod]
[Test]
public void EpubAsPlainTextTest2()
{
var book = EpubReader.Read(@"../../Samples/epub-assorted/iOS Hackers Handbook.epub");
//File.WriteAllText("../../Samples/epub-assorted/iOS Hackers Handbook.txt", book.ToPlainText());
var book = EpubReader.Read(@"Samples/epub-assorted/iOS Hackers Handbook.epub");
//File.WriteAllText("Samples/epub-assorted/iOS Hackers Handbook.txt", book.ToPlainText());

Func<string, string> normalize = text => text.Replace("\r", "").Replace("\n", "").Replace(" ", "");
var expected = File.ReadAllText(@"../../Samples/epub-assorted/iOS Hackers Handbook.txt");
var expected = File.ReadAllText(@"Samples/epub-assorted/iOS Hackers Handbook.txt");
var actual = book.ToPlainText();
Assert.AreEqual(normalize(expected), normalize(actual));

Expand Down
8 changes: 4 additions & 4 deletions EpubSharp.Tests/EpubReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
using System.Text;
using System.Threading.Tasks;
using EpubSharp.Format;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;

namespace EpubSharp.Tests
{
[TestClass]
[TestFixture]
public class EpubReaderTests
{
[TestMethod]
[Test]
public void ReadBogtyvenFormatTest()
{
var book = EpubReader.Read(@"../../Samples/epub-assorted/Bogtyven.epub");
var book = EpubReader.Read(@"Samples/epub-assorted/Bogtyven.epub");
var format = book.Format;

Assert.IsNotNull(format, nameof(format));
Expand Down
103 changes: 0 additions & 103 deletions EpubSharp.Tests/EpubSharp.Tests.csproj

This file was deleted.

22 changes: 22 additions & 0 deletions EpubSharp.Tests/EpubSharp.Tests.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>d620fd17-e50f-42bb-b384-9a5c258fdb48</ProjectGuid>
<RootNamespace>EpubSharp.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
16 changes: 8 additions & 8 deletions EpubSharp.Tests/EpubTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
using System.IO;
using System.Linq;
using EpubSharp.Format;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;

namespace EpubSharp.Tests
{
[TestClass]
[TestFixture]
public class EpubTests
{
[TestMethod]
[Test]
public void ReadWriteEpub30Test()
{
var archives = Utils.ZipAndCopyEpubs(@"../../Samples/epub30");
var archives = Utils.ZipAndCopyEpubs(@"Samples/epub30");
ReadWriteTest(archives);
}

[TestMethod]
[Test]
public void ReadWriteEpub31Test()
{
var archives = Utils.ZipAndCopyEpubs(@"../../Samples/epub31");
var archives = Utils.ZipAndCopyEpubs(@"Samples/epub31");
ReadWriteTest(archives);
}

[TestMethod]
[Test]
public void ReadWriteEpubAssortedTest()
{
var archives = Utils.ZipAndCopyEpubs(@"../../Samples/epub-assorted");
var archives = Utils.ZipAndCopyEpubs(@"Samples/epub-assorted");
ReadWriteTest(archives);
}

Expand Down
38 changes: 17 additions & 21 deletions EpubSharp.Tests/EpubWriterTests.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EpubSharp.Format;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;

namespace EpubSharp.Tests
{
[TestClass]
[TestFixture]
public class EpubWriterTests
{
[TestMethod]
[Test]
public void CanWriteTest()
{
var book = EpubReader.Read(@"../../Samples/epub-assorted/Inversions - Iain M. Banks.epub");
var book = EpubReader.Read(@"Samples/epub-assorted/Inversions - Iain M. Banks.epub");
var writer = new EpubWriter(book);
writer.Write(new MemoryStream());
}

[TestMethod]
[Test]
public void CanCreateEmptyEpubTest()
{
var epub = WriteAndRead(new EpubWriter());
Expand Down Expand Up @@ -48,7 +44,7 @@ public void CanCreateEmptyEpubTest()
Assert.IsNull(epub.Format.Nav);
}

[TestMethod]
[Test]
public void AddRemoveAuthorTest()
{
var writer = new EpubWriter();
Expand Down Expand Up @@ -78,7 +74,7 @@ public void AddRemoveAuthorTest()
writer.ClearAuthors();
}

[TestMethod]
[Test]
public void AddRemoveTitleTest()
{
var writer = new EpubWriter();
Expand All @@ -98,7 +94,7 @@ public void AddRemoveTitleTest()
writer.RemoveTitle();
}

[TestMethod]
[Test]
public void SetCoverTest()
{
var writer = new EpubWriter();
Expand All @@ -110,10 +106,10 @@ public void SetCoverTest()
Assert.IsNotNull(epub.CoverImage);
}

[TestMethod]
[Test]
public void RemoveCoverTest()
{
var epub1 = EpubReader.Read(@"../../Samples/epub-assorted/Inversions - Iain M. Banks.epub");
var epub1 = EpubReader.Read(@"Samples/epub-assorted/Inversions - Iain M. Banks.epub");

var writer = new EpubWriter(EpubWriter.MakeCopy(epub1));
writer.RemoveCover();
Expand All @@ -125,15 +121,15 @@ public void RemoveCoverTest()
Assert.AreEqual(epub1.Resources.Images.Count - 1, epub2.Resources.Images.Count);
}

[TestMethod]
[Test]
public void RemoveCoverWhenThereIsNoCoverTest()
{
var writer = new EpubWriter();
writer.RemoveCover();
writer.RemoveCover();
}

[TestMethod]
[Test]
public void CanAddChapterTest()
{
var writer = new EpubWriter();
Expand All @@ -158,7 +154,7 @@ public void CanAddChapterTest()
}
}

[TestMethod]
[Test]
public void ClearChaptersTest()
{
var writer = new EpubWriter();
Expand All @@ -176,17 +172,17 @@ public void ClearChaptersTest()
Assert.AreEqual(0, epub.TableOfContents.Count);
}

[TestMethod]
[Test]
public void ClearBogtyvenChaptersTest()
{
var writer = new EpubWriter(EpubReader.Read(@"../../Samples/epub-assorted/bogtyven.epub"));
var writer = new EpubWriter(EpubReader.Read(@"Samples/epub-assorted/bogtyven.epub"));
writer.ClearChapters();

var epub = WriteAndRead(writer);
Assert.AreEqual(0, epub.TableOfContents.Count);
}

[TestMethod]
[Test]
public void AddFileTest()
{
var writer = new EpubWriter();
Expand Down
25 changes: 4 additions & 21 deletions EpubSharp.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,18 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EpubSharp.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EpubSharp.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98f234c0-d712-4258-a289-03fd40951029")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: Guid("d620fd17-e50f-42bb-b384-9a5c258fdb48")]
Loading

0 comments on commit 094c099

Please sign in to comment.