Skip to content

Commit

Permalink
Added support for netcoreapp3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NimaAra committed Oct 20, 2019
1 parent b52c7f0 commit 74ec779
Show file tree
Hide file tree
Showing 26 changed files with 577 additions and 1,071 deletions.
12 changes: 6 additions & 6 deletions Easy.Common.Tests.Unit/Accessors/AccessorPropertyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ public void When_checking_invalid_input()
.Message.ShouldBe("String must not be null, empty or whitespace.");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildSetter<Person, string>(nullPropInfo))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: propertyInfo");
.Message.ShouldBe("Value cannot be null. (Parameter 'propertyInfo')");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildGetter<Person, string>(nullStr))
.Message.ShouldBe("String must not be null, empty or whitespace.");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildGetter<Person, string>(nullPropInfo))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: propertyInfo");
.Message.ShouldBe("Value cannot be null. (Parameter 'propertyInfo')");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildSetter<Person>(nullStr))
.Message.ShouldBe("String must not be null, empty or whitespace.");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildSetter<Person>(nullPropInfo))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: propertyInfo");
.Message.ShouldBe("Value cannot be null. (Parameter 'propertyInfo')");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildGetter<Person>(nullStr))
.Message.ShouldBe("String must not be null, empty or whitespace.");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildGetter<Person>(nullPropInfo))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: propertyInfo");
.Message.ShouldBe("Value cannot be null. (Parameter 'propertyInfo')");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildSetter(nullPropInfo))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: propertyInfo");
.Message.ShouldBe("Value cannot be null. (Parameter 'propertyInfo')");

Should.Throw<ArgumentException>(() => AccessorBuilder.BuildGetter(nullPropInfo))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: propertyInfo");
.Message.ShouldBe("Value cannot be null. (Parameter 'propertyInfo')");
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Easy.Common.Tests.Unit.ActiveDirectoryHelper
{
#if NETFRAMEWORK
using NUnit.Framework;
using Shouldly;
using ActiveDirectoryHelper = Easy.Common.ActiveDirectoryHelper;
Expand All @@ -16,4 +17,5 @@ public void When_getting_groups_for_the_current_user()
groups.ShouldContain("Everyone");
}
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task Run()
sender.ShouldNotBeNull();
sender.ShouldBeOfType<BlockingTaskNotifier>();
stackTrace.ShouldNotBeNullOrEmpty();
stackTrace.ShouldContain("at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)");
stackTrace.ShouldContain("at System.Environment.get_StackTrace()");
count.ShouldBe(1);
}
}
Expand Down
58 changes: 0 additions & 58 deletions Easy.Common.Tests.Unit/BloomFilter/BloomFilterTests.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public void When_comparing_byte_arrays()

left = null;
Should.Throw<ArgumentNullException>(() => left.Compare(right))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: left");
.Message.ShouldBe("Value cannot be null. (Parameter 'left')");

left = new byte[] {1};
right = null;

Should.Throw<ArgumentNullException>(() => left.Compare(right))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: right");
.Message.ShouldBe("Value cannot be null. (Parameter 'right')");

left = new byte[0];
right = new byte[0];
Expand Down
2 changes: 0 additions & 2 deletions Easy.Common.Tests.Unit/ConfigReader/Configuration.config
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@

<add key="file-path-1" format="C:\some-folder\some-file" />
<add key="file-path-2" format="C:\some-folder\some-file.txt" />
<add key="file-path-invalid" format="C:\some-folder\some | file.txt" />
<add key="directory-path-1" format="C:\some-folder" />
<add key="directory-path-2" format="C:\some-folder\" />
<add key="directory-path-invalid" format="C:\some | folder\" />

<add key="uri-1" format="http://www.google.com/api" />
<add key="uri-2" format="http://www.google.com/api/" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Run()
ConfigReader.ConfigFile.Name.ShouldBe("Configuration.config");

ConfigReader.Settings.ShouldNotBeNull();
ConfigReader.Settings.Count.ShouldBe(58);
ConfigReader.Settings.Count.ShouldBe(56);

ConfigReader.Settings.ShouldContainKey("should-not-be-ignored");

Expand Down Expand Up @@ -232,9 +232,6 @@ public void Run()
ConfigReader.TryRead("file-path-2", out fileInfoVal).ShouldBeTrue();
fileInfoVal.FullName.ShouldBe(@"C:\some-folder\some-file.txt");

ConfigReader.TryRead("file-path-invalid", out fileInfoVal).ShouldBeFalse();
fileInfoVal.ShouldBe(default(FileInfo));

ConfigReader.TryRead("non-existent-key", out fileInfoVal).ShouldBeFalse();
fileInfoVal.ShouldBe(default(FileInfo));

Expand All @@ -244,9 +241,6 @@ public void Run()
ConfigReader.TryRead("directory-path-2", out directoryInfoVal).ShouldBeTrue();
directoryInfoVal.FullName.ShouldBe(@"C:\some-folder\");

ConfigReader.TryRead("directory-path-invalid", out directoryInfoVal).ShouldBeFalse();
directoryInfoVal.ShouldBe(default(DirectoryInfo));

ConfigReader.TryRead("non-existent-key", out directoryInfoVal).ShouldBeFalse();
directoryInfoVal.ShouldBe(default(DirectoryInfo));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public void When_generating_full_report()
report.EnvironmentVariables.ShouldNotBeEmpty();
report.NetworkingDetails.ShouldNotBeNull();

report.SystemDetails.CPU.ShouldNotBe("<INVALID>");

var formattedReport = report.ToString();
formattedReport.ShouldNotBeNull();
formattedReport.Length.ShouldBeGreaterThan(1000);
Expand Down
14 changes: 6 additions & 8 deletions Easy.Common.Tests.Unit/Easy.Common.Tests.Unit.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="NSubstitute" Version="4.2.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Shouldly" Version="3.0.2" />
</ItemGroup>
<ItemGroup>
Expand All @@ -14,10 +16,6 @@
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<None Update="Assembly\DotNet2.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
2 changes: 1 addition & 1 deletion Easy.Common.Tests.Unit/EasyPool/EasyPoolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal sealed class EasyPoolTests
public void When_creating_a_pool_with_null_factory()
{
var ex = Should.Throw<ArgumentNullException>(() => new EasyPool<string>(null, null, 10));
ex.Message.ShouldBe("Value cannot be null.\r\nParameter name: factory");
ex.Message.ShouldBe("Value cannot be null. (Parameter 'factory')");
ex.ParamName.ShouldBe("factory");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void When_checking_a_null_string_collection()
Action action = () => Ensure.NotNullOrEmpty(collection);

action.ShouldThrow<ArgumentNullException>("Because collection is null.")
.Message.ShouldBe("Value cannot be null.\r\nParameter name: collection");
.Message.ShouldBe("Value cannot be null. (Parameter 'collection')");
}

[Test]
Expand Down
6 changes: 3 additions & 3 deletions Easy.Common.Tests.Unit/Ensure/EnsuringNotNullTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public void When_ensuring_null_string()
{
string nullStr = null;
Should.Throw<ArgumentException>(() => Ensure.NotNull(nullStr, "nullStr"))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: nullStr");
.Message.ShouldBe("Value cannot be null. (Parameter 'nullStr')");
}

[Test]
public void When_ensuring_null_object()
{
object nullObj = null;
Should.Throw<ArgumentException>(() => Ensure.NotNull(nullObj, "nullObj"))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: nullObj");
.Message.ShouldBe("Value cannot be null. (Parameter 'nullObj')");
}

[Test]
Expand All @@ -45,7 +45,7 @@ public void When_ensuring_null_object_with_null_argument_name()
{
object nullObject = null;
Should.Throw<ArgumentException>(() => Ensure.NotNull(nullObject, null))
.Message.ShouldBe("Value cannot be null.\r\nParameter name: Invalid");
.Message.ShouldBe("Value cannot be null. (Parameter 'Invalid')");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public void When_converting_sequence_to_hashset_with_default_comparer()
sequence.Count(x => x == "C").ShouldBe(3);
sequence.Count(x => x == "D").ShouldBe(1);

var hashSet = sequence.ToHashSet();
var hashSet = EnumerableExtensions.ToHashSet(sequence);

hashSet.Count.ShouldBe(4);

Expand Down Expand Up @@ -265,7 +265,7 @@ public void When_converting_sequence_to_hashset_with_non_default_comparer()
sequence.Count(x => x == "C").ShouldBe(3);
sequence.Count(x => x == "D").ShouldBe(1);

var hashSet = sequence.ToHashSet(StringComparer.OrdinalIgnoreCase);
var hashSet = EnumerableExtensions.ToHashSet(sequence, StringComparer.OrdinalIgnoreCase);

hashSet.Count.ShouldBe(4);

Expand Down Expand Up @@ -302,7 +302,7 @@ public void When_converting_sequence_to_easy_dictionary_with_default_comparer()
Should.Throw<KeyNotFoundException>(() =>
{
var _ = keyedCollection["name-10"];
}).Message.ShouldBe("The given key was not present in the dictionary.");
}).Message.ShouldBe("The given key 'name-10' was not present in the dictionary.");
}

[Test]
Expand All @@ -320,7 +320,7 @@ public void When_converting_sequence_to_easy_dictionary_with_non_default_compare
[Test]
public void When_creating_batch_from_list_with_buckets_of_size_zero() =>
Should.Throw<ArgumentOutOfRangeException>(() => new List<int>().Batch(0).ToArray())
.Message.ShouldBe("Specified argument was out of the range of valid values.\r\nParameter name: size");
.Message.ShouldBe("Specified argument was out of the range of valid values. (Parameter 'size')");

[Test]
public void When_creating_batch_from_empty_list()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void CreatingWithPositiveBoundedCapacityAndNullConsumer()
};

action.ShouldThrow<ArgumentNullException>()
.Message.ShouldBe("Value cannot be null.\r\nParameter name: consumer");
.Message.ShouldBe("Value cannot be null. (Parameter 'consumer')");
}

[Test]
Expand Down

0 comments on commit 74ec779

Please sign in to comment.