Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerwal committed Jun 6, 2014
1 parent 9c0e652 commit e160c91
Show file tree
Hide file tree
Showing 14 changed files with 206 additions and 1,173 deletions.
113 changes: 113 additions & 0 deletions Coverage.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File name extension must be .runsettings -->
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<!--
Additional paths to search for .pdb (symbol) files. Symbols must be found for modules to be instrumented.
If .pdb files are in the same folder as the .dll or .exe files, they are automatically found. Otherwise, specify them here.
Note that searching for symbols increases code coverage runtime. So keep this small and local.
-->
<!--
<SymbolSearchPaths>
<Path>C:\Users\User\Documents\Visual Studio 2013\Projects\ProjectX\bin\Debug</Path>
<Path>\\mybuildshare\builds\ProjectX</Path>
</SymbolSearchPaths>
-->

<!--
About include/exclude lists:
Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
Each element in the list is a regular expression (ECMAScript syntax). See http://msdn.microsoft.com/library/2k3te2cs.aspx.
An item must first match at least one entry in the include list to be included.
Included items must then not match any entries in the exclude list to remain included.
-->

<!-- Match assembly file paths: -->
<ModulePaths>
<Include>
<ModulePath>.*\.dll$</ModulePath>
<ModulePath>.*\.exe$</ModulePath>
</Include>
<Exclude>
<ModulePath>.*CPPUnitTestFramework.*</ModulePath>
<ModulePath>.*TestAdapter.*</ModulePath>
</Exclude>
</ModulePaths>

<!-- Match fully qualified names of functions: -->
<!-- (Use "\." to delimit namespaces in C# or Visual Basic, "::" in C++.) -->
<Functions>
<Exclude>
<Function>^Fabrikam\.UnitTest\..*</Function>
<Function>^std::.*</Function>
<Function>^ATL::.*</Function>
<Function>.*::__GetTestMethodInfo.*</Function>
<Function>^Microsoft::VisualStudio::CppCodeCoverageFramework::.*</Function>
<Function>^Microsoft::VisualStudio::CppUnitTestFramework::.*</Function>
</Exclude>
</Functions>

<!-- Match attributes on any code element: -->
<Attributes>
<Exclude>
<!-- Don’t forget "Attribute" at the end of the name -->
<Attribute>^System.Diagnostics.DebuggerHiddenAttribute$</Attribute>
<Attribute>^System.Diagnostics.DebuggerNonUserCodeAttribute$</Attribute>
<Attribute>^System.Runtime.CompilerServices.CompilerGeneratedAttribute$</Attribute>
<Attribute>^System.CodeDom.Compiler.GeneratedCodeAttribute$</Attribute>
<Attribute>^System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute$</Attribute>
<Attribute>^NUnit.Framework.TestFixtureAttribute$</Attribute>
<Attribute>^Xunit.FactAttribute$</Attribute>
<Attribute>^Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute$</Attribute>
</Exclude>
</Attributes>

<!-- Match the path of the source files in which each method is defined: -->
<Sources>
<Exclude>
<Source>.*\\atlmfc\\.*</Source>
<Source>.*\\vctools\\.*</Source>
<Source>.*\\public\\sdk\\.*</Source>
<Source>.*\\microsoft sdks\\.*</Source>
<Source>.*\\vc\\include\\.*</Source>
</Exclude>
</Sources>

<!-- Match the company name property in the assembly: -->
<CompanyNames>
<Exclude>
<CompanyName>.*microsoft.*</CompanyName>
</Exclude>
</CompanyNames>

<!-- Match the public key token of a signed assembly: -->
<PublicKeyTokens>
<!-- Exclude Visual Studio extensions: -->
<Exclude>
<PublicKeyToken>^B77A5C561934E089$</PublicKeyToken>
<PublicKeyToken>^B03F5F7F11D50A3A$</PublicKeyToken>
<PublicKeyToken>^31BF3856AD364E35$</PublicKeyToken>
<PublicKeyToken>^89845DCD8080CC91$</PublicKeyToken>
<PublicKeyToken>^71E9BCE111E9429C$</PublicKeyToken>
<PublicKeyToken>^8F50407C4E9E73B6$</PublicKeyToken>
<PublicKeyToken>^E361AF139669C375$</PublicKeyToken>
</Exclude>
</PublicKeyTokens>


<!-- We recommend you do not change the following values: -->
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
<CollectFromChildProcesses>True</CollectFromChildProcesses>
<CollectAspDotNet>False</CollectAspDotNet>

</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
14 changes: 9 additions & 5 deletions MediaHandle.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaHandleConsole", "MediaHandleConsole\MediaHandleConsole.csproj", "{DE9ABED8-52FF-45F8-B754-306A7C32F5B5}"
EndProject
Expand All @@ -20,6 +20,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DDEA22B9-E91E-4FC2-9DF6-E27A9478388F}"
ProjectSection(SolutionItems) = preProject
CookComputing.XmlRpcV2.dll = CookComputing.XmlRpcV2.dll
Coverage.runsettings = Coverage.runsettings
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchProcessing.Test", "SearchProcessing.Test\SearchProcessing.Test\SearchProcessing.Test.csproj", "{800AC89B-1CAA-4253-93F9-2F3E7B1CDB93}"
Expand Down Expand Up @@ -109,11 +110,14 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{87FA7D4B-8E8E-4F3C-B4B7-51FF6EE61E32} = {D6B8DF17-36CE-470F-9EC5-116C658DE972}
{FDD731D7-44E8-49C6-8AAB-5F8F6E5069FC} = {D6B8DF17-36CE-470F-9EC5-116C658DE972}
{73F0D388-A089-4C9D-8E3B-4098271E505D} = {899B38B9-28F8-41F1-BBBC-C615D23A86C4}
{C3DDE97A-9AB7-4469-8F59-3DBC5A518401} = {899B38B9-28F8-41F1-BBBC-C615D23A86C4}
{00FF18B8-4357-4791-865E-2518039824CC} = {7FEF7D5F-6154-4B98-AFAD-6018B25ECA5A}
{73F0D388-A089-4C9D-8E3B-4098271E505D} = {899B38B9-28F8-41F1-BBBC-C615D23A86C4}
{FDD731D7-44E8-49C6-8AAB-5F8F6E5069FC} = {D6B8DF17-36CE-470F-9EC5-116C658DE972}
{87FA7D4B-8E8E-4F3C-B4B7-51FF6EE61E32} = {D6B8DF17-36CE-470F-9EC5-116C658DE972}
{800AC89B-1CAA-4253-93F9-2F3E7B1CDB93} = {7FEF7D5F-6154-4B98-AFAD-6018B25ECA5A}
{00FF18B8-4357-4791-865E-2518039824CC} = {7FEF7D5F-6154-4B98-AFAD-6018B25ECA5A}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<Compile Include="EnumUtilitiesTest.cs" />
<Compile Include="HashUtilityTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StringExtensionsTest.cs" />
<Compile Include="StringValueAttributeTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MediaHandleUtilities\MediaHandleUtilities\MediaHandleUtilities.csproj">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MediaHandleUtilities.Test
{
[TestClass]
public class StringExtensionsTest
{
[TestMethod]
public void ContainsIgnoreCaseFoundTest()
{
const string testString = "The quick brown fox jumps over the lazy dog. Was he fast? No he was not! There were 2 beagles chasing him.";

bool doesContain = testString.Contains("dog", StringComparison.InvariantCultureIgnoreCase);
Assert.IsTrue(doesContain, "The string does contain 'dog'.");

doesContain = testString.Contains("FAST?", StringComparison.InvariantCultureIgnoreCase);
Assert.IsTrue(doesContain, "The string does contain 'fast?'.");

doesContain = testString.Contains("2 beaGLes", StringComparison.InvariantCultureIgnoreCase);
Assert.IsTrue(doesContain, "The string does contain '2 beagles'.");
}

[TestMethod]
public void ContainsNotFoundTest()
{
const string testString = "The quick brown fox jumps over the lazy dog. Was he fast? No he was not! There were 2 beagles chasing him.";

bool doesContain = testString.Contains("apple", StringComparison.InvariantCultureIgnoreCase);
Assert.IsFalse(doesContain, "The string does NOT contain 'apple'.");

doesContain = testString.Contains("3 beagles", StringComparison.InvariantCultureIgnoreCase);
Assert.IsFalse(doesContain, "The string does NOT contain '3 bealges'.");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace MediaHandleUtilities.Test
{
[TestClass]
public class StringValueAttributeTest
{
[TestMethod]
public void StringValueAttributeIntegrationTest()
{
string outputString = EnumUtilities.GetStringValue(DummyEnum.Red);

string expectedString = Enum.GetName(typeof(DummyEnum), DummyEnum.Red);

Assert.AreEqual(expectedString, outputString, "The returned value of the enum did not match the expected output.");

string outputEmptyString = EnumUtilities.GetStringValue(DummyEnum.Blue);
Assert.AreEqual(string.Empty, outputEmptyString, "The returned value of the enum with an empty string was not an empty string.");

string outputNullString = EnumUtilities.GetStringValue(DummyEnum.Yellow);
Assert.IsNull(outputNullString, "The returned value of the enum with no StringValue was not null.");
}

#region Helper Enum

private enum DummyEnum
{
[StringValue("Red")]
Red = 1,

[StringValue("")]
Blue = 2,

Yellow = 3,
}

#endregion Helper Enum
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using MediaHandleUtilities.Annotations;
using System.Configuration;
using System.Configuration;

namespace MediaHandleUtilities.Configuration
{
[UsedImplicitly]
public class OpenSubtitlesConfiguration : ConfigurationSection
{
[ConfigurationProperty("Username")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
<Compile Include="Configuration\OpenSubtitlesConfiguration.cs" />
<Compile Include="EnumUtilities.cs" />
<Compile Include="HashUtility.cs" />
<Compile Include="Properties\Annotations.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StringValueAttribute.cs" />
Expand Down
Loading

0 comments on commit e160c91

Please sign in to comment.