1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/lunarsf-Lunar-Markdown-Editor

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
MDTestTests.cs 2.2 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
LunarSF Отправлено 9 лет назад ab5a981
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.IO;
using MarkdownSharp;
using NUnit.Framework;
namespace MarkdownSharpTests
{
[TestFixture]
public class MDTestTests : BaseTest
{
const string folder = "testfiles.mdtest_1._1";
private static IEnumerable<TestCaseData> GetTests()
{
Markdown m = new Markdown();
Assembly assembly = Assembly.GetAssembly(typeof(BaseTest));
string namespacePrefix = String.Concat(assembly.GetName().Name, '.', folder);
string[] resourceNames = assembly.GetManifestResourceNames();
Func<string, string> getResourceFileContent = filename =>
{
using (Stream stream = assembly.GetManifestResourceStream(filename))
{
if (stream == null)
return null;
using (StreamReader streamReader = new StreamReader(stream))
return streamReader.ReadToEnd();
}
};
return from name in resourceNames
// Skip resource names that aren't within the namespace (folder) we want
// and doesn't have the extension '.html'.
where name.StartsWith(namespacePrefix) && name.EndsWith(".html")
let actualName = Path.ChangeExtension(name, "text")
let actualContent = getResourceFileContent(actualName)
let actual = Program.RemoveWhitespace(m.Transform(actualContent))
let expectedContent = getResourceFileContent(name)
let expected = Program.RemoveWhitespace(expectedContent)
select new TestCaseData(actualName, name, actual, expected);
}
[Test, TestCaseSource("GetTests")]
public void Test(string actualName, string expectedName, string actual, string expected)
{
Assert.That(actual,
Is.EqualTo(expected),
"Mismatch between '{0}' and the transformed '{1}'.",
actualName,
expectedName);
}
}
}

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/lunarsf-Lunar-Markdown-Editor.git
git@gitlife.ru:oschina-mirror/lunarsf-Lunar-Markdown-Editor.git
oschina-mirror
lunarsf-Lunar-Markdown-Editor
lunarsf-Lunar-Markdown-Editor
v0.4-beta8