1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Ajout tests unitaires

This commit is contained in:
Yan Maniez 2018-09-02 16:38:57 +02:00
parent 68411a786d
commit 3938bb42e4
4 changed files with 92 additions and 1 deletions

View file

@ -21,6 +21,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AideDeJeuCmd", "AideDeJeu\A
{C0597D88-5C09-4314-80A3-64712B02D0E9} = {C0597D88-5C09-4314-80A3-64712B02D0E9}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AideDeJeuUnitTest", "AideDeJeu\AideDeJeuUnitTest\AideDeJeuUnitTest.csproj", "{443C655C-FDE9-48C9-95E4-630DD368ABDB}"
ProjectSection(ProjectDependencies) = postProject
{C0597D88-5C09-4314-80A3-64712B02D0E9} = {C0597D88-5C09-4314-80A3-64712B02D0E9}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@ -357,6 +362,54 @@ Global
{9DDAEA8E-7B4F-4CC1-80FC-0D511D230689}.Release|x64.Build.0 = Release|Any CPU
{9DDAEA8E-7B4F-4CC1-80FC-0D511D230689}.Release|x86.ActiveCfg = Release|Any CPU
{9DDAEA8E-7B4F-4CC1-80FC-0D511D230689}.Release|x86.Build.0 = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|ARM.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|iPhone.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|x64.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|x64.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|x86.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.AppStore|x86.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|ARM.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|iPhone.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|x64.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|x64.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|x86.ActiveCfg = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Debug|x86.Build.0 = Debug|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|Any CPU.Build.0 = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|ARM.ActiveCfg = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|ARM.Build.0 = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|iPhone.ActiveCfg = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|iPhone.Build.0 = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|x64.ActiveCfg = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|x64.Build.0 = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|x86.ActiveCfg = Release|Any CPU
{443C655C-FDE9-48C9-95E4-630DD368ABDB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.3.2" />
<PackageReference Include="MSTest.TestFramework" Version="1.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AideDeJeu\AideDeJeu.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,18 @@
using AideDeJeu.ViewModels;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace AideDeJeuUnitTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var store = new StoreViewModel();
var item = store.ToItem(null, AideDeJeu.Tools.Helpers.GetResourceString($"AideDeJeu.Data.sandbox.md"));
var md = item.Markdown;
Assert.IsNotNull(md);
}
}
}

View file

@ -18,7 +18,8 @@ namespace AideDeJeuWeb.Controllers
{
//var items = AideDeJeu.Tools.Helpers.GetResourceObject<IEnumerable<Spell>>("AideDeJeu.Data.spells_vf.json");
var md = await AideDeJeu.Tools.Helpers.GetResourceStringAsync("AideDeJeu.Data.spells_hd.md");
var item = AideDeJeu.Tools.MarkdownExtensions.ToItem(md);
var store = new StoreViewModel();
var item = store.ToItem(null, md);
var items = item as Items;
var fitems = items.Where(it => (it as Spell).Source.Contains(classe)).OrderBy(it => (it as Spell).Level).ThenBy(it => it.Name);