Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit 992d95a

Browse files
committed
Merge branch 'dev' of https://github.com/AltaModaTech/LINQExtensions into dev
2 parents 5ea56d7 + be13440 commit 992d95a

6 files changed

Lines changed: 74 additions & 37 deletions

File tree

AMT.LinqExtensions/AMT.LinqExtensions.csproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<VersionPrefix>1.0.0</VersionPrefix>
4+
<VersionPrefix>2.0.0</VersionPrefix>
55
<!-- Assembly attributes -->
66
<AssemblyName>AMT.LinqExtensions</AssemblyName>
77
<AssemblyTitle>AMT LINQ Extensions</AssemblyTitle>
8-
<Company>AltaModa Technologies</Company>
8+
<Company>AltaModa Technologies, LLC</Company>
99
<GenerateAssemblyCompanyAttribute />
1010
<GenerateAssemblyConfigurationAttribute />
1111
<GenerateAssemblyCopyrightAttribute />
@@ -37,20 +37,19 @@
3737
RepositoryUrl
3838
-->
3939
<Authors>AltaModaTech</Authors>
40-
<Copyright>AltaModa Technologies</Copyright>
40+
<Copyright>AltaModa Technologies, LLC</Copyright>
4141
<Description>A few LINQ Extensions which we find useful, and you may, too.</Description>
42-
<PackageTags>LINQ</PackageTags>
4342
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
4443
<PackageProjectUrl>https://github.com/AltaModaTech/LINQExtensions</PackageProjectUrl>
4544
<PackageTags>LINQ</PackageTags>
4645
<Title>LINQ Extensions by AltaModa Technologies</Title>
4746
</PropertyGroup>
4847

4948
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
50-
<TargetFrameworks>net452;netstandard1.0</TargetFrameworks>
49+
<TargetFrameworks>net452;net46;net461;netstandard1.0;netstandard1.1;netstandard1.2;netstandard1.3;netstandard1.4;netstandard1.5;netstandard1.6;netstandard2.0</TargetFrameworks>
5150
</PropertyGroup>
5251
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
53-
<TargetFramework>netstandard1.0</TargetFramework>
52+
<TargetFrameworks>netstandard1.0;netstandard1.1;netstandard1.2;netstandard1.3;netstandard1.4;netstandard1.5;netstandard1.6;netstandard2.0</TargetFrameworks>
5453
</PropertyGroup>
5554

5655
</Project>

NuGet.config

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@
33
<packageSources>
44
<!--To inherit the global NuGet package sources remove the <clear/>line below -->
55
<clear/>
6-
<!--
7-
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"/>
8-
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json"/>
9-
-->
10-
<!-- ### These are from https://github.com/aspnet/home#upgrading-dnvm-or-running-without-visual-studio
11-
Maybe AspNet feed is more stable?
12-
-->
13-
<!--
14-
<add key="AspNetCI" value="https://www.myget.org/F/aspnetvnext/api/v3/index.json" />
15-
-->
6+
167
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"/>
178
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
189
</packageSources>

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
# LINQExtensions
1+
# LINQExtensions
2+
A few LINQ extensions we find useful - maybe you will, too.

test/IntListTestFixture.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Xunit;
4+
5+
6+
namespace Test.AMT.LinqExtensions
7+
{
8+
9+
public class TestDataFixture : IDisposable
10+
{
11+
12+
public List<int> TestList { get; set; }
13+
14+
public TestDataFixture()
15+
{
16+
TestList = new List<int>();
17+
for (int i = 0; i < 250; ++i)
18+
{
19+
TestList.Add(i);
20+
}
21+
22+
}
23+
24+
25+
#region IDisposable Support
26+
private bool disposedValue = false; // To detect redundant calls
27+
28+
protected virtual void Dispose(bool disposing)
29+
{
30+
if (!disposedValue)
31+
{
32+
disposedValue = true;
33+
}
34+
}
35+
36+
// This code added to correctly implement the disposable pattern.
37+
void IDisposable.Dispose()
38+
{
39+
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
40+
Dispose(true);
41+
}
42+
43+
#endregion IDisposable Support
44+
45+
}
46+
47+
}

test/LinqExtensionsTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,27 @@ namespace Test.AMT.LinqExtensions
1010
// TODO: include when doing code coverage
1111
// [ExcludeFromCodeCoverage]
1212

13-
public class LinqRandomizerTests
13+
public class LinqRandomizerTests : IClassFixture<TestDataFixture>
1414
{
15+
TestDataFixture _testData;
16+
17+
public LinqRandomizerTests(TestDataFixture testData)
18+
{
19+
_testData = testData;
20+
}
21+
1522

1623
#region Positive tests
1724

1825
[Fact]
1926
public void random_element_from_int_list()
2027
{
21-
List<int> list = new List<int>();
22-
for (int i = 0; i < 250; ++i) { list.Add(i); }
23-
2428
// Get random elements from ~1/10 of the list. The probability of sequential duplicates
2529
// increases when covering more of the available elements.
2630
int prev = -1;
27-
for (int i = 0; i < list.Count/10; ++i)
31+
for (int i = 0; i < _testData.TestList.Count/10; ++i)
2832
{
29-
int curr = list.Random();
33+
int curr = _testData.TestList.Random();
3034
curr.Should().NotBe(prev);
3135
prev = curr;
3236
}
@@ -36,10 +40,7 @@ public void random_element_from_int_list()
3640
[Fact]
3741
public void random_element_from_int_list_by_IEnumerable()
3842
{
39-
List<int> list = new List<int>();
40-
for (int i = 0; i < 250; ++i) { list.Add(i); }
41-
42-
IEnumerable<int> enumr = list;
43+
IEnumerable<int> enumr = _testData.TestList;
4344
foreach (var itr in enumr)
4445
{
4546
int curr = enumr.Random();
@@ -67,7 +68,6 @@ public void random_element_from_single_item_list()
6768
[Fact]
6869
public void random_element_from_()
6970
{
70-
7171
SortedList<int, string> list = new SortedList<int, string>();
7272
for (int i = 0; i < 250; ++i) { list.Add(i, i.ToString()); }
7373

test/test.csproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<VersionPrefix>1.0.0</VersionPrefix>
5-
<!-- -->
4+
<Copyright>AltaModa Technologies, LLC</Copyright>
5+
<VersionPrefix>2.0.0</VersionPrefix>
66
<AssemblyName>Test.AMT.LinqExtensions</AssemblyName>
7-
<!-- -->
87
<IsPackable>false</IsPackable>
98
</PropertyGroup>
109

1110
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
12-
<TargetFrameworks>net452;netcoreapp1.0</TargetFrameworks>
11+
<TargetFrameworks>net452;net46;net461;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0</TargetFrameworks>
1312
</PropertyGroup>
1413
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
15-
<TargetFramework>netcoreapp1.0</TargetFramework>
14+
<TargetFrameworks>netcoreapp1.0;netcoreapp1.1;netcoreapp2.0</TargetFrameworks>
1615
</PropertyGroup>
1716

1817
<ItemGroup>
1918
<ProjectReference Include="..\AMT.LinqExtensions\AMT.LinqExtensions.csproj" />
2019
</ItemGroup>
2120

2221
<ItemGroup>
23-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
24-
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
25-
<PackageReference Include="xunit" Version="2.2.0" />
26-
<PackageReference Include="FluentAssertions" Version="4.19.*" />
22+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.*" />
23+
<PackageReference Include="xunit.runner.visualstudio" Version="2.*" />
24+
<PackageReference Include="xunit" Version="2.*" />
25+
<PackageReference Include="FluentAssertions" Version="4.*" />
2726
</ItemGroup>
2827

2928
</Project>

0 commit comments

Comments
 (0)