Merge pull request #77 from RockyTV/net-std

Add support for .NET Standard and unit tests
This commit is contained in:
Drew DeVault 2017-08-18 21:06:15 -04:00 committed by GitHub
commit 7d2f91e154
7 changed files with 163 additions and 84 deletions

View File

@ -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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -11,6 +11,7 @@
<FileAlignment>512</FileAlignment>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworks>netstandard2.0;net4</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -40,55 +41,11 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ChannelCollection.cs" />
<Compile Include="ClientSettings.cs" />
<Compile Include="Events\ChannelTopicEventArgs.cs" />
<Compile Include="Events\ChannelEventArgs.cs" />
<Compile Include="Events\ChannelUserEventArgs.cs" />
<Compile Include="Events\ErrorEventArgs.cs" />
<Compile Include="Events\ErrorReplieEventArgs.cs" />
<Compile Include="Events\IrcNoticeEventArgs.cs" />
<Compile Include="Events\ErronousNickEventArgs.cs" />
<Compile Include="Events\ModeChangeEventArgs.cs" />
<Compile Include="Events\PrivateMessageEventArgs.cs" />
<Compile Include="Events\RawMessageEventArgs.cs" />
<Compile Include="Events\ServerMOTDEventArgs.cs" />
<Compile Include="Events\SocketErrorEventArgs.cs" />
<Compile Include="Events\SupportsEventArgs.cs" />
<Compile Include="Events\WhoIsEventArgs.cs" />
<Compile Include="Handlers\ChannelHandlers.cs" />
<Compile Include="Handlers\ErrorHandlers.cs" />
<Compile Include="Handlers\ListingHandlers.cs" />
<Compile Include="Handlers\MessageHandlers.cs" />
<Compile Include="Handlers\MOTDHandlers.cs" />
<Compile Include="Handlers\ServerHandlers.cs" />
<Compile Include="Handlers\UserHandlers.cs" />
<Compile Include="IrcChannel.cs" />
<Compile Include="IrcClient.Commands.cs" />
<Compile Include="IrcClient.cs" />
<Compile Include="IrcMessage.cs" />
<Compile Include="IrcProtocolException.cs" />
<Compile Include="IrcUser.cs" />
<Compile Include="Mask.cs" />
<Compile Include="MaskCollection.cs" />
<Compile Include="PrivateMessage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RequestManager.cs" />
<Compile Include="ServerInfo.cs" />
<Compile Include="WhoIs.cs" />
<Compile Include="Events\KickEventArgs.cs" />
<Compile Include="Events\NickChangedEventArgs.cs" />
<Compile Include="UserPool.cs" />
<Compile Include="UserPoolView.cs" />
<Compile Include="Events\UserEventArgs.cs" />
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
<Target Name="BeforeBuild"></Target><Target Name="AfterBuild"></Target>
-->
</Project>

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ChatSharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChatSharp")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("53b25724-8945-43a6-bcba-42b5dfa2c272")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{24D593EC-CA81-41DC-9FE7-A434DDDE229D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChatSharp.Tests</RootNamespace>
<AssemblyName>ChatSharp.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="IrcMessageTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChatSharp\ChatSharp.csproj">
<Project>{4033affa-bea3-4bdf-84ea-59a23360fd36}</Project>
<Name>ChatSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@ -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);
}
}
}

View File

@ -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")]

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.1.11" targetFramework="net452" />
<package id="MSTest.TestFramework" version="1.1.11" targetFramework="net452" />
</packages>