From b80fe34de03b1ba446737e0c1015a7e9308ab86e Mon Sep 17 00:00:00 2001 From: Alexandre Oliveira Date: Fri, 18 Aug 2017 22:03:59 -0300 Subject: [PATCH] Add testing project --- ChatSharp.sln | 18 +++++- ChatSharpTests/ChatSharp.Tests.csproj | 73 +++++++++++++++++++++++ ChatSharpTests/IrcMessageTests.cs | 45 ++++++++++++++ ChatSharpTests/Properties/AssemblyInfo.cs | 20 +++++++ ChatSharpTests/packages.config | 5 ++ 5 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 ChatSharpTests/ChatSharp.Tests.csproj create mode 100644 ChatSharpTests/IrcMessageTests.cs create mode 100644 ChatSharpTests/Properties/AssemblyInfo.cs create mode 100644 ChatSharpTests/packages.config diff --git a/ChatSharp.sln b/ChatSharp.sln index 7e4ca8a..eeb3bbd 100644 --- a/ChatSharp.sln +++ b/ChatSharp.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.15 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatSharp", "ChatSharp\ChatSharp.csproj", "{4033AFFA-BEA3-4BDF-84EA-59A23360FD36}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatSharp.Tests", "ChatSharpTests\ChatSharp.Tests.csproj", "{24D593EC-CA81-41DC-9FE7-A434DDDE229D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,6 +27,18 @@ Global {4033AFFA-BEA3-4BDF-84EA-59A23360FD36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {4033AFFA-BEA3-4BDF-84EA-59A23360FD36}.Release|Mixed Platforms.Build.0 = Release|Any CPU {4033AFFA-BEA3-4BDF-84EA-59A23360FD36}.Release|x86.ActiveCfg = Release|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Debug|x86.ActiveCfg = Debug|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Debug|x86.Build.0 = Debug|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Release|Any CPU.Build.0 = Release|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Release|x86.ActiveCfg = Release|Any CPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ChatSharpTests/ChatSharp.Tests.csproj b/ChatSharpTests/ChatSharp.Tests.csproj new file mode 100644 index 0000000..be3c99c --- /dev/null +++ b/ChatSharpTests/ChatSharp.Tests.csproj @@ -0,0 +1,73 @@ + + + + + Debug + AnyCPU + {24D593EC-CA81-41DC-9FE7-A434DDDE229D} + Library + Properties + ChatSharp.Tests + ChatSharp.Tests + v4.5.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + {4033affa-bea3-4bdf-84ea-59a23360fd36} + ChatSharp + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/ChatSharpTests/IrcMessageTests.cs b/ChatSharpTests/IrcMessageTests.cs new file mode 100644 index 0000000..c0be504 --- /dev/null +++ b/ChatSharpTests/IrcMessageTests.cs @@ -0,0 +1,45 @@ +using System; +using ChatSharp; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace ChatSharp.Tests +{ + [TestClass] + public class IrcMessageTests + { + [TestMethod] + public void NewValidMessage() + { + try + { + IrcMessage fromMessage = new IrcMessage(@":user!~ident@host PRIVMSG target :Lorem ipsum dolor sit amet"); + } + catch (Exception e) + { + Assert.Fail("Expected no exception, got: {0}", e.Message); + } + } + + [TestMethod] + public void NewValidMessage_Command() + { + IrcMessage fromMessage = new IrcMessage(@":user!~ident@host PRIVMSG target :Lorem ipsum dolor sit amet"); + Assert.AreEqual(fromMessage.Command, "PRIVMSG"); + } + + [TestMethod] + public void NewValidMessage_Prefix() + { + IrcMessage fromMessage = new IrcMessage(@":user!~ident@host PRIVMSG target :Lorem ipsum dolor sit amet"); + Assert.AreEqual(fromMessage.Prefix, "user!~ident@host"); + } + + [TestMethod] + public void NewValidMessage_Params() + { + IrcMessage fromMessage = new IrcMessage(@":user!~ident@host PRIVMSG target :Lorem ipsum dolor sit amet"); + string[] compareParams = new string[] { "target", "Lorem ipsum dolor sit amet" }; + CollectionAssert.AreEqual(fromMessage.Parameters, compareParams); + } + } +} diff --git a/ChatSharpTests/Properties/AssemblyInfo.cs b/ChatSharpTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f35b3a6 --- /dev/null +++ b/ChatSharpTests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("ChatSharpTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ChatSharpTests")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("24d593ec-ca81-41dc-9fe7-a434ddde229d")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ChatSharpTests/packages.config b/ChatSharpTests/packages.config new file mode 100644 index 0000000..1ab7218 --- /dev/null +++ b/ChatSharpTests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file