Commit 738a3d68 authored by Stefm's avatar Stefm

Small fixes and more unit tests

parent 64adb0dc
# Changelog #
##8.1.0 (2016-11-27)##
###New###
- Added unit tests for Helper.GetResolutionString()
###Fix###
- Wrong default unknown string in ParserSettings
---
##8.1.0 (2016-11-27)##
###New###
- Added Methods to parse full directories
......
......@@ -12,132 +12,132 @@ namespace SeriesIDParser.Test
[TestClass]
public class GetResolutionStringTests
{
//[TestMethod]
//public void GetResolutionStringTestLowestDefault()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
// Assert.AreEqual(ps.ResolutionStringFullHD,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p, ResolutionsMap.UltraHD_2160p }),
// "(1) Should give one full HD");
//}
//[TestMethod]
//public void GetResolutionStringTestLowest()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
// Assert.AreEqual(ps.ResolutionStringFullHD, Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p }),
// "(2) Should give one full HD");
//}
//[TestMethod]
//public void GetResolutionStringTestLowest()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
// Assert.AreEqual(ps.ResolutionStringFullHD,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.Unknown, ResolutionsMap.UltraHD8K_4320p, ResolutionsMap.FullHD_1080p }),
// "(3) Should give one full HD");
//}
//[TestMethod]
//public void GetResolutionStringTestLowest()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
// Assert.AreEqual(ps.ResolutionStringUnknown, Helper.GetResolutionString(ps, new List<ResolutionsMap>()), "(4) Should give unknown");
//}
//[TestMethod]
//public void GetResolutionStringTestHighestDefault()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
// Assert.AreEqual(ps.ResolutionStringUltraHD,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p, ResolutionsMap.UltraHD_2160p }),
// "(10) Should give one UHD");
//}
//[TestMethod]
//public void GetResolutionStringTestHighest()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
// Assert.AreEqual(ps.ResolutionStringFullHD,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p }),
// "(11) Should give one full HD");
//}
//[TestMethod]
//public void GetResolutionStringTestHighest()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
// Assert.AreEqual(ps.ResolutionStringUltraHD8k,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.Unknown, ResolutionsMap.UltraHD8K_4320p, ResolutionsMap.FullHD_1080p }),
// "(12) Should give one UHD");
//}
//[TestMethod]
//public void GetResolutionStringTestHighest()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
// Assert.AreEqual(ps.ResolutionStringUnknown,
// Helper.GetResolutionString(ps, new List<ResolutionsMap>()),
// "(13) Should give unknown");
//}
//[TestMethod]
//public void GetResolutionStringTestAllDefault()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
// Assert.AreEqual(ps.ResolutionStringFullHD + ps.NewSpacingChar + ps.ResolutionStringUltraHD,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p, ResolutionsMap.UltraHD_2160p }),
// "(20) Should give HD + UHD");
//}
//[TestMethod]
//public void GetResolutionStringTestAll()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
// Assert.AreEqual(ps.ResolutionStringFullHD,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p }),
// "(21) Should give one full HD");
//}
//[TestMethod]
//public void GetResolutionStringTestAll()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
// Assert.AreEqual(ps.ResolutionStringFullHD + ps.NewSpacingChar + ps.ResolutionStringUltraHD8k,
// Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.Unknown, ResolutionsMap.UltraHD8K_4320p, ResolutionsMap.FullHD_1080p }),
// "(22) Should give UHD HD");
//}
//[TestMethod]
//public void GetResolutionStringTestAll()
//{
// ParserSettings ps = new ParserSettings(true);
// ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
// Assert.AreEqual(ps.ResolutionStringUnknown,
// Helper.GetResolutionString(ps, new List<ResolutionsMap>()),
// "(23) Should give unknown");
//}
[TestMethod]
public void GetResolutionStringTestLowestDefault()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
Assert.AreEqual(ps.ResolutionStringFullHD,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p, ResolutionsMap.UltraHD_2160p }),
"(1) Should give one full HD");
}
[TestMethod]
public void GetResolutionStringTestLowestSingle()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
Assert.AreEqual(ps.ResolutionStringFullHD, Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p }),
"(2) Should give one full HD");
}
[TestMethod]
public void GetResolutionStringTestLowestWithUnknown()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
Assert.AreEqual(ps.ResolutionStringFullHD,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.Unknown, ResolutionsMap.UltraHD8K_4320p, ResolutionsMap.FullHD_1080p }),
"(3) Should give one full HD");
}
[TestMethod]
public void GetResolutionStringTestLowestEmpty()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.LowestResolution;
Assert.AreEqual(ps.ResolutionStringUnknown, Helper.GetResolutionString(ps, new List<ResolutionsMap>()), "(4) Should give unknown");
}
[TestMethod]
public void GetResolutionStringTestHighestDefault()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
Assert.AreEqual(ps.ResolutionStringUltraHD,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p, ResolutionsMap.UltraHD_2160p }),
"(10) Should give one UHD");
}
[TestMethod]
public void GetResolutionStringTestHighestSingle()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
Assert.AreEqual(ps.ResolutionStringFullHD,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p }),
"(11) Should give one full HD");
}
[TestMethod]
public void GetResolutionStringTestHighestUnknown()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
Assert.AreEqual(ps.ResolutionStringUltraHD8k,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.Unknown, ResolutionsMap.UltraHD8K_4320p, ResolutionsMap.FullHD_1080p }),
"(12) Should give one UHD");
}
[TestMethod]
public void GetResolutionStringTestHighestEmpty()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.HighestResolution;
Assert.AreEqual(ps.ResolutionStringUnknown,
Helper.GetResolutionString(ps, new List<ResolutionsMap>()),
"(13) Should give unknown");
}
[TestMethod]
public void GetResolutionStringTestAllDefault()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
Assert.AreEqual(ps.ResolutionStringFullHD + ps.NewSpacingChar + ps.ResolutionStringUltraHD,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p, ResolutionsMap.UltraHD_2160p }),
"(20) Should give HD + UHD");
}
[TestMethod]
public void GetResolutionStringTestAllSingle()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
Assert.AreEqual(ps.ResolutionStringFullHD,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.FullHD_1080p }),
"(21) Should give one full HD");
}
[TestMethod]
public void GetResolutionStringTestAllUnknown()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
Assert.AreEqual(ps.ResolutionStringFullHD + ps.NewSpacingChar + ps.ResolutionStringUltraHD8k,
Helper.GetResolutionString(ps, new List<ResolutionsMap> { ResolutionsMap.Unknown, ResolutionsMap.UltraHD8K_4320p, ResolutionsMap.FullHD_1080p }),
"(22) Should give UHD HD");
}
[TestMethod]
public void GetResolutionStringTestAllEmpty()
{
ParserSettings ps = new ParserSettings(true);
ps.ResolutionStringOutput = ResolutionOutputBehavior.AllFoundResolutions;
Assert.AreEqual(ps.ResolutionStringUnknown,
Helper.GetResolutionString(ps, new List<ResolutionsMap>()),
"(23) Should give unknown");
}
}
}
......@@ -5,9 +5,9 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeriesIDParser", "SeriesIDParser\SeriesIDParser.csproj", "{D584FD1D-63D3-4FE2-A229-7F01E7A93797}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeriesIDParser_Test", "SeriesIDParser.Test\SeriesIDParser.Test.csproj", "{6F30FEEF-A65B-4E54-8014-AD9FC2D440CC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeriesIDParser.Test", "SeriesIDParser.Test\SeriesIDParser.Test.csproj", "{6F30FEEF-A65B-4E54-8014-AD9FC2D440CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeriesIDParser_WinForm_Demo", "SeriesIDParser.WinForm.Demo\SeriesIDParser.WinForm.Demo.csproj", "{3A90193D-8664-42CD-B49D-DCD2B9E6CB4D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeriesIDParser.WinForm.Demo", "SeriesIDParser.WinForm.Demo\SeriesIDParser.WinForm.Demo.csproj", "{3A90193D-8664-42CD-B49D-DCD2B9E6CB4D}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SeriesIDParserCore", "SeriesIDParserCore\SeriesIDParserCore.xproj", "{958064FF-C77F-478C-9243-3E374D2BDAC0}"
EndProject
......
......@@ -28,10 +28,13 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
[assembly: InternalsVisibleTo("SeriesIDParser.Test")]
namespace SeriesIDParser
{
internal static class Helper
......@@ -44,7 +47,7 @@ namespace SeriesIDParser
/// <returns></returns>
internal static string GetResolutionString(ParserSettings settings, IList<ResolutionsMap> res)
{
// TODO: Only 72% Covered
// TODO: Only 69% Covered
string output = ResolutionsMap.Unknown.ToString() + settings.NewSpacingChar;
if (res != null && res.Count > 0 && !(res.Count == 1 && res.Contains(ResolutionsMap.Unknown)))
......
......@@ -188,9 +188,9 @@ namespace SeriesIDParser
/// <summary>
/// Defines the string who is convertet from the enum Resolutions to something readable for e.g. the ParsedString. Default: 'UNKNOWN'
/// Defines the string who is convertet from the enum Resolutions to something readable for e.g. the ParsedString. Default: 'Unknown'
/// </summary>
public string ResolutionStringUnknown { get; set; } = "UNKNOWN";
public string ResolutionStringUnknown { get; set; } = "Unknown";
/// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment