-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #471 from baynezy/release/7.0.1.9
Release version 7.0.1.9
- Loading branch information
Showing
6 changed files
with
129 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"major":"7","minor":"0","patch":"0","build":"8"} | ||
{"major":"7","minor":"0","patch":"1","build":"9"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using System.Collections.Generic; | ||
using Html2Markdown.Replacement; | ||
using Html2Markdown.Scheme; | ||
|
||
namespace Html2Markdown.Test.Scheme; | ||
|
||
public class AbstractSchemeTests | ||
{ | ||
[Test] | ||
public void Replacers_WhenCalled_ReturnsReplacerCollection() | ||
{ | ||
// arrange | ||
const int expectedCount = 1; | ||
var scheme = new TestScheme(); | ||
|
||
// act | ||
var replacers = scheme.Replacers(); | ||
|
||
// assert | ||
Assert.That(replacers.Count, Is.EqualTo(expectedCount)); | ||
} | ||
|
||
[Test] | ||
public void Replacers_WhenCalled_ReturnsReplacerCollectionWithTestReplacer() | ||
{ | ||
// arrange | ||
var scheme = new TestScheme(); | ||
|
||
// act | ||
var replacers = scheme.Replacers(); | ||
|
||
// assert | ||
Assert.That(replacers[0], Is.InstanceOf<TestReplacer>()); | ||
} | ||
|
||
[Test] | ||
public void Replacers_WhenCalled_ReturnsReplacerCollectionWithTestReplacerReplaceMethod() | ||
{ | ||
// arrange | ||
const string expected = "test"; | ||
var scheme = new TestScheme(); | ||
|
||
// act | ||
var replacers = scheme.Replacers(); | ||
var result = replacers[0].Replace(string.Empty); | ||
|
||
// assert | ||
Assert.That(result, Is.EqualTo(expected)); | ||
} | ||
|
||
[Test] | ||
public void AddReplacer_WhenCalled_AddsReplacerToReplacerCollection() | ||
{ | ||
// arrange | ||
const int expectedCount = 2; | ||
var scheme = new TestScheme(); | ||
|
||
// act | ||
scheme.AddReplacer(new TestReplacer()); | ||
var replacers = scheme.Replacers(); | ||
|
||
// assert | ||
Assert.That(replacers.Count, Is.EqualTo(expectedCount)); | ||
} | ||
|
||
[Test] | ||
public void AddReplacer_WhenCalled_AddsReplacerToReplacerCollectionWithTestReplacer() | ||
{ | ||
// arrange | ||
var scheme = new TestScheme(); | ||
|
||
// act | ||
scheme.AddReplacer(new TestReplacer()); | ||
var replacers = scheme.Replacers(); | ||
|
||
// assert | ||
Assert.That(replacers[1], Is.InstanceOf<TestReplacer>()); | ||
} | ||
} | ||
|
||
public class TestScheme : AbstractScheme | ||
{ | ||
public TestScheme() | ||
{ | ||
AddReplacementGroup(ReplacerCollection, new TestReplacementGroup()); | ||
} | ||
} | ||
|
||
public class TestReplacementGroup : IReplacementGroup | ||
{ | ||
public IEnumerable<IReplacer> Replacers() | ||
{ | ||
return new List<IReplacer> | ||
{ | ||
new TestReplacer() | ||
}; | ||
} | ||
} | ||
|
||
public class TestReplacer : IReplacer | ||
{ | ||
public string Replace(string html) | ||
{ | ||
return "test"; | ||
} | ||
} |