Skip to content

Commit

Permalink
Implemented .NET Standard 1.1 support in addition to .NET Framework 4…
Browse files Browse the repository at this point in the history
….0. (#4)

* Implemented .NET Standard 1.1 support in addition to .NET Framework 4.0.
* Updated the solution to Visual Studio 2017.
* Updated NuGet packages.
  • Loading branch information
aueda authored Sep 13, 2018
1 parent 1f84874 commit 610eb18
Show file tree
Hide file tree
Showing 23 changed files with 123 additions and 385 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,9 @@ $RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

# ASP.NET Core lock files
*.lock.json

# VS 2015
.vs
15 changes: 6 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
sudo: false
language: csharp
solution: Maoli.sln

install:
- nuget restore Maoli.sln
- nuget install xunit.runners -Version 1.9.2 -OutputDirectory testrunner

mono: none
dotnet: 2.0.0
dist: trusty
script:
- xbuild /p:Configuration=Release Maoli.sln
- mono ./testrunner/xunit.runners.1.9.2/tools/xunit.console.clr4.exe ./Maoli.Tests/bin/Release/Maoli.Tests.dll
- cd Maoli.Tests
- dotnet restore
- dotnet test
6 changes: 3 additions & 3 deletions Maoli.Tests/CnpjTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void CompleteReturnsAValidCnpj()
{
var actual = Cnpj.Complete("639433150001");

Assert.Equal<string>(CnpjTest.looseValidCnpj, actual);
Assert.Equal(CnpjTest.looseValidCnpj, actual);
}

[Fact]
Expand Down Expand Up @@ -389,7 +389,7 @@ public void ToStringReturnsStringWithNoPunctuationIfCnpjPunctuationIsStrict()
var expected = looseValidCnpj;
var actual = Cnpj.ToString();

Assert.Equal<string>(expected, actual);
Assert.Equal(expected, actual);
}

[Fact]
Expand All @@ -400,7 +400,7 @@ public void ToStringReturnsStringWithNoPunctuationIfCnpjPunctuationIsLoose()
var expected = looseValidCnpj;
var actual = Cnpj.ToString();

Assert.Equal<string>(expected, actual);
Assert.Equal(expected, actual);
}

[Fact]
Expand Down
6 changes: 3 additions & 3 deletions Maoli.Tests/CpfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void CompleteReturnsAValidCpf()
{
var actual = Cpf.Complete("714025658");

Assert.Equal<string>(CpfTest.looseValidCpf, actual);
Assert.Equal(CpfTest.looseValidCpf, actual);
}

[Fact]
Expand Down Expand Up @@ -477,7 +477,7 @@ public void ToStringReturnsStringWithNoPunctuationIfCpfPunctuationIsStrict()
var expected = "71402565860";
var actual = cpf.ToString();

Assert.Equal<string>(expected, actual);
Assert.Equal(expected, actual);
}

[Fact]
Expand All @@ -488,7 +488,7 @@ public void ToStringReturnsStringWithNoPunctuationIfCpfPunctuationIsLoose()
var expected = "71402565860";
var actual = cpf.ToString();

Assert.Equal<string>(expected, actual);
Assert.Equal(expected, actual);
}

[Fact]
Expand Down
112 changes: 16 additions & 96 deletions Maoli.Tests/Maoli.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,102 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.runner.visualstudio.2.0.0-rc4-build1049\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.0.0-rc4-build1049\build\net20\xunit.runner.visualstudio.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6EBE6C42-4BF7-42E2-A09A-E6F44526379E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Maoli.Tests</RootNamespace>
<AssemblyName>Maoli.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.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>
<TargetFrameworkProfile />
<TargetFramework>netcoreapp2.0</TargetFramework>

<IsPackable>false</IsPackable>
</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>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="xunit">
<HintPath>..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="CnpjTest.cs" />
<Compile Include="CpfTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CepTest.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Maoli\Maoli.csproj">
<Project>{66620b5a-d754-44dd-9349-b44759d1c617}</Project>
<Name>Maoli</Name>
</ProjectReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<None Include="packages.config" />
<ProjectReference Include="..\Maoli\Maoli.csproj" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<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. Enable 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\xunit.runner.visualstudio.2.0.0-rc4-build1049\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.0.0-rc4-build1049\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- 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>
-->
</Project>

</Project>
36 changes: 0 additions & 36 deletions Maoli.Tests/Properties/AssemblyInfo.cs

This file was deleted.

5 changes: 0 additions & 5 deletions Maoli.Tests/packages.config

This file was deleted.

33 changes: 19 additions & 14 deletions Maoli.sln
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2003
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maoli", "Maoli\Maoli.csproj", "{66620B5A-D754-44DD-9349-B44759D1C617}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maoli", "Maoli\Maoli.csproj", "{7B077AF7-3181-4ECC-9F57-8A5EE0CB1F6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maoli.Tests", "Maoli.Tests\Maoli.Tests.csproj", "{6EBE6C42-4BF7-42E2-A09A-E6F44526379E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maoli.Tests", "Maoli.Tests\Maoli.Tests.csproj", "{836C1655-DDF5-4C79-8987-C8AD8EAC881A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3558581C-D2FF-4934-80C4-0E0C95CB05FE}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{89369AFA-AFB1-4927-B5A5-3B89499A38C2}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
.travis.yml = .travis.yml
LEIAME.md = LEIAME.md
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Expand All @@ -20,16 +22,19 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{66620B5A-D754-44DD-9349-B44759D1C617}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66620B5A-D754-44DD-9349-B44759D1C617}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66620B5A-D754-44DD-9349-B44759D1C617}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66620B5A-D754-44DD-9349-B44759D1C617}.Release|Any CPU.Build.0 = Release|Any CPU
{6EBE6C42-4BF7-42E2-A09A-E6F44526379E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EBE6C42-4BF7-42E2-A09A-E6F44526379E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EBE6C42-4BF7-42E2-A09A-E6F44526379E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EBE6C42-4BF7-42E2-A09A-E6F44526379E}.Release|Any CPU.Build.0 = Release|Any CPU
{7B077AF7-3181-4ECC-9F57-8A5EE0CB1F6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B077AF7-3181-4ECC-9F57-8A5EE0CB1F6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B077AF7-3181-4ECC-9F57-8A5EE0CB1F6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B077AF7-3181-4ECC-9F57-8A5EE0CB1F6C}.Release|Any CPU.Build.0 = Release|Any CPU
{836C1655-DDF5-4C79-8987-C8AD8EAC881A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{836C1655-DDF5-4C79-8987-C8AD8EAC881A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{836C1655-DDF5-4C79-8987-C8AD8EAC881A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{836C1655-DDF5-4C79-8987-C8AD8EAC881A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {96C402B9-BD5B-44F6-BF03-D06F6A65A11E}
EndGlobalSection
EndGlobal
5 changes: 0 additions & 5 deletions Maoli/Cep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@

namespace Maoli
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/// <summary>
/// Represents a valid CEP number
/// </summary>
Expand Down
5 changes: 1 addition & 4 deletions Maoli/CepHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ namespace Maoli
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

/// <summary>
/// Helper class for <see cref="Cep"/> class
Expand Down Expand Up @@ -49,7 +46,7 @@ static CepHelper()
/// <returns>true if CNPJ string is valid; false otherwise</returns>
internal static bool Validate(string value, CepPunctuation punctuation)
{
if (string.IsNullOrWhiteSpace(value))
if (StringHelper.IsNullOrWhiteSpace(value))
{
return false;
}
Expand Down
6 changes: 0 additions & 6 deletions Maoli/CepPunctuation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

namespace Maoli
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// Indicates how punctuation must be validated
/// </summary>
Expand Down
8 changes: 2 additions & 6 deletions Maoli/Cnpj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
namespace Maoli
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// Represents a valid CNPJ number
Expand Down Expand Up @@ -40,7 +36,7 @@ public Cnpj(string value)
/// how validation must be handled</param>
public Cnpj(string value, CnpjPunctuation punctuation)
{
if (string.IsNullOrWhiteSpace(value))
if (StringHelper.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("O CNPJ não pode ser nulo ou branco");
}
Expand Down Expand Up @@ -188,7 +184,7 @@ public override int GetHashCode()

unchecked
{
hash = (hash * 31) + (string.IsNullOrWhiteSpace(this.parsedValue) ? 0 : this.parsedValue.GetHashCode());
hash = (hash * 31) + (StringHelper.IsNullOrWhiteSpace(this.parsedValue) ? 0 : this.parsedValue.GetHashCode());
}

return hash;
Expand Down
Loading

0 comments on commit 610eb18

Please sign in to comment.