Skip to content

Commit

Permalink
Releasing 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek-galezowski committed Sep 29, 2018
1 parent 6b24b15 commit 1a23d8e
Show file tree
Hide file tree
Showing 90 changed files with 532 additions and 222 deletions.
4 changes: 2 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ Task("Pack")
Summary = "Anonymous value generator, supporting the 'Any.Whatever()' syntax proposed on the www.sustainabletdd.com blog.",
Description = "Anonymous value generator, supporting the 'Any.Whatever()' syntax proposed on the www.sustainabletdd.com blog. It makes use of the static usings and extension methods to achieve flexibility and extensibility.",
Language = "en-US",
ReleaseNotes = new[] {"Added License URL to nuget so that companies with strict license policies can verify it."},
ReleaseNotes = new[] {"Added debugging trace in exceptions. Broken backwards-compatibility in extensibility part."},
ProjectUrl = new Uri("https://github.com/grzesiek-galezowski/any"),
OutputDirectory = "./nuget",
LicenseUrl = new Uri("https://raw.githubusercontent.com/grzesiek-galezowski/any/master/LICENSE"),
Version = "1.1.6",
Version = "2.0.0",
Symbols = false,
Files = new []
{
Expand Down
6 changes: 6 additions & 0 deletions src/net45/AnyExtensibility/AnyExtensibility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,11 @@
<Link>AnyExtensibility.snk</Link>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommonTypes\CommonTypes.csproj">
<Project>{4b302f64-2ba2-47ed-afc6-28a6e3832f15}</Project>
<Name>CommonTypes</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
<Project>{15b7beac-2ba7-450a-952e-a3cc333e7c24}</Project>
<Name>AnyExtensibility</Name>
</ProjectReference>
<ProjectReference Include="..\CommonTypes\CommonTypes.csproj">
<Project>{4b302f64-2ba2-47ed-afc6-28a6e3832f15}</Project>
<Name>CommonTypes</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\netstandard2.0\AnyGenerators.Collections\TddToolkit.snk">
Expand Down
4 changes: 4 additions & 0 deletions src/net45/AnyGenerators.Generic/AnyGenerators.Generic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
<Project>{979601e6-cf7a-40d3-94e4-936f4746c393}</Project>
<Name>AutoFixtureWrapper</Name>
</ProjectReference>
<ProjectReference Include="..\CommonTypes\CommonTypes.csproj">
<Project>{4b302f64-2ba2-47ed-afc6-28a6e3832f15}</Project>
<Name>CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\TypeReflection\TypeReflection.csproj">
<Project>{de66fefd-bac1-44b1-871e-f4775cafe9ea}</Project>
<Name>TypeReflection</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
<Project>{15b7beac-2ba7-450a-952e-a3cc333e7c24}</Project>
<Name>AnyExtensibility</Name>
</ProjectReference>
<ProjectReference Include="..\CommonTypes\CommonTypes.csproj">
<Project>{4b302f64-2ba2-47ed-afc6-28a6e3832f15}</Project>
<Name>CommonTypes</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\netstandard2.0\AnyGenerators.Invokable\TddToolkit.snk">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
<Project>{15b7beac-2ba7-450a-952e-a3cc333e7c24}</Project>
<Name>AnyExtensibility</Name>
</ProjectReference>
<ProjectReference Include="..\CommonTypes\CommonTypes.csproj">
<Project>{4b302f64-2ba2-47ed-afc6-28a6e3832f15}</Project>
<Name>CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\TypeReflection.Interfaces\TypeReflection.Interfaces.csproj">
<Project>{4a53fff3-3bdd-4e3e-911e-b0ad6a91eeae}</Project>
<Name>TypeReflection.Interfaces</Name>
Expand Down
4 changes: 4 additions & 0 deletions src/net45/AnyGenerators.Network/AnyGenerators.Network.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
<Project>{15b7beac-2ba7-450a-952e-a3cc333e7c24}</Project>
<Name>AnyExtensibility</Name>
</ProjectReference>
<ProjectReference Include="..\CommonTypes\CommonTypes.csproj">
<Project>{4b302f64-2ba2-47ed-afc6-28a6e3832f15}</Project>
<Name>CommonTypes</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\netstandard2.0\AnyGenerators.Network\TddToolkit.snk">
Expand Down
4 changes: 4 additions & 0 deletions src/net45/AnyGenerators.Root/AnyGenerators.Root.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@
<Project>{4b302f64-2ba2-47ed-afc6-28a6e3832f15}</Project>
<Name>CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\TypeReflection\TypeReflection.csproj">
<Project>{de66fefd-bac1-44b1-871e-f4775cafe9ea}</Project>
<Name>TypeReflection</Name>
</ProjectReference>
<ProjectReference Include="..\TypeResolution\TypeResolution.csproj">
<Project>{e09bceec-34fb-4726-8722-02213d7d0807}</Project>
<Name>TypeResolution</Name>
Expand Down
6 changes: 6 additions & 0 deletions src/net45/CommonTypes/CommonTypes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<Compile Include="..\..\netstandard2.0\CommonTypes\CircularList.cs">
<Link>CircularList.cs</Link>
</Compile>
<Compile Include="..\..\netstandard2.0\CommonTypes\GenerationFailedException.cs">
<Link>GenerationFailedException.cs</Link>
</Compile>
<Compile Include="..\..\netstandard2.0\CommonTypes\ListBasedGenerationTrace.cs">
<Link>ListBasedGenerationTrace.cs</Link>
</Compile>
<Compile Include="..\..\netstandard2.0\CommonTypes\Maybe.cs">
<Link>Maybe.cs</Link>
</Compile>
Expand Down
6 changes: 6 additions & 0 deletions src/net45/TypeReflection/TypeReflection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@
<AssemblyOriginatorKeyFile>..\..\netstandard2.0\TypeReflection\TypeReflection.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=5.4.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.5.4.2\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="Ploeh.AutoFixture, Version=3.51.0.0, Culture=neutral, PublicKeyToken=b24654c590009d4f, processorArchitecture=MSIL">
<HintPath>..\packages\AutoFixture.3.51.0\lib\net40\Ploeh.AutoFixture.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down
2 changes: 2 additions & 0 deletions src/net45/TypeReflection/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoFixture" version="3.51.0" targetFramework="net45" />
<package id="FluentAssertions" version="5.4.2" targetFramework="net45" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net45" />
</packages>
9 changes: 9 additions & 0 deletions src/net45/TypeResolution/TypeResolution.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@
<Compile Include="..\..\netstandard2.0\TypeResolution\FallbackTypeGenerator.cs">
<Link>FallbackTypeGenerator.cs</Link>
</Compile>
<Compile Include="..\..\netstandard2.0\TypeResolution\FillFieldsCustomization.cs">
<Link>FillFieldsCustomization.cs</Link>
</Compile>
<Compile Include="..\..\netstandard2.0\TypeResolution\FillPropertiesCustomization.cs">
<Link>FillPropertiesCustomization.cs</Link>
</Compile>
<Compile Include="..\..\netstandard2.0\TypeResolution\IFallbackGeneratedObjectCustomization.cs">
<Link>IFallbackGeneratedObjectCustomization.cs</Link>
</Compile>
<Compile Include="..\..\netstandard2.0\TypeResolution\InterceptedInvocation.cs">
<Link>InterceptedInvocation.cs</Link>
</Compile>
Expand Down
4 changes: 3 additions & 1 deletion src/netstandard2.0/AnyExtensibility/InlineGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using TddXt.CommonTypes;

namespace TddXt.AnyExtensibility
{
public interface InlineGenerator<out T>
{
T GenerateInstance(InstanceGenerator instanceGenerator);
T GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace);
}

}
10 changes: 5 additions & 5 deletions src/netstandard2.0/AnyExtensibility/InstanceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

namespace TddXt.AnyExtensibility
{
public interface InstanceGenerator : BasicGenerator
public interface InstanceGenerator
{
object Instance(Type type);
T ValueOtherThan<T>(params T[] omittedValues);
T Value<T>();
T Value<T>(T seed);
T Value<T>(GenerationTrace trace);
T Value<T>(T seed, GenerationTrace trace);
T OtherThan<T>(params T[] omittedValues);
T Dummy<T>();
object Instance(Type type, GenerationTrace trace);
T Dummy<T>(GenerationTrace trace);
T Instance<T>(GenerationTrace trace);
}

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
internal static class CollectionFiller //todo make up a better name
{
public static ICollection<T> FillingCollection<T>(ICollection<T> collection, int many, BasicGenerator instanceGenerator)
public static ICollection<T> FillingCollection<T>(ICollection<T> collection, int many,
InstanceGenerator instanceGenerator, GenerationTrace trace)
{
for (int i = 0; i < many; ++i)
{
collection.Add(instanceGenerator.Instance<T>());
collection.Add(instanceGenerator.Instance<T>(trace));
}

return collection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
Expand All @@ -13,13 +14,13 @@ public DictionaryWithKeysGenerator(IEnumerable<TKey> keys)
_keys = keys;
}

public Dictionary<TKey, TValue> GenerateInstance(InstanceGenerator instanceGenerator)
public Dictionary<TKey, TValue> GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
{
var dict = new Dictionary<TKey, TValue>();

foreach (var key in _keys)
{
dict.Add(key, instanceGenerator.Instance<TValue>());
dict.Add(key, instanceGenerator.Instance<TValue>(trace));
}

return dict;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
Expand All @@ -17,9 +18,9 @@ public class EnumerableConversion<TInput, TResult> : InlineGenerator<TResult>
_conversion = conversion;
}

public TResult GenerateInstance(InstanceGenerator instanceGenerator)
public TResult GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
{
return _conversion(_enumerableGenerator.GenerateInstance(instanceGenerator));
return _conversion(_enumerableGenerator.GenerateInstance(instanceGenerator, trace));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
Expand All @@ -12,10 +13,10 @@ public EnumerableGenerator(int length)
_length = length;
}

public IEnumerable<T> GenerateInstance(InstanceGenerator instanceGenerator)
public IEnumerable<T> GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
{
//todo create empty collection factory to be able to use object here
return CollectionFiller.FillingCollection(new List<T>(), _length, instanceGenerator);
return CollectionFiller.FillingCollection(new List<T>(), _length, instanceGenerator, trace);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
public class EnumeratorGenerator<T> : InlineGenerator<IEnumerator<T>>
{
public IEnumerator<T> GenerateInstance(InstanceGenerator instanceGenerator)
public IEnumerator<T> GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
{
return new EnumerableGenerator<T>(Configuration.Many)
.AsList<T>().GenerateInstance(instanceGenerator).GetEnumerator();
.AsList<T>().GenerateInstance(instanceGenerator, trace).GetEnumerator();
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
Expand All @@ -12,7 +13,7 @@ public ExclusiveEnumerableGenerator(T[] excluded)
_excluded = excluded;
}

public IEnumerable<T> GenerateInstance(InstanceGenerator instanceGenerator)
public IEnumerable<T> GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
{
var result = new List<T>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
Expand All @@ -12,12 +13,12 @@ public InclusiveEnumerableGenerator(IEnumerable<T> included)
_included = included;
}

public IEnumerable<T> GenerateInstance(InstanceGenerator instanceGenerator)
public IEnumerable<T> GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
{
var list = new List<T>();
list.Add(instanceGenerator.Instance<T>());
list.Add(instanceGenerator.Instance<T>(trace));
list.AddRange(_included);
list.Add(instanceGenerator.Instance<T>());
list.Add(instanceGenerator.Instance<T>(trace));

return list;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System.Collections.Generic;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Collections
{
public class KeyValuePairGenerator<TKey, TValue> : InlineGenerator<KeyValuePair<TKey, TValue>>
{
public KeyValuePair<TKey, TValue> GenerateInstance(InstanceGenerator gen)
public KeyValuePair<TKey, TValue> GenerateInstance(InstanceGenerator gen, GenerationTrace trace)
{
return new KeyValuePair<TKey, TValue>(gen.Instance<TKey>(), gen.Instance<TValue>());
return new KeyValuePair<TKey, TValue>(gen.Instance<TKey>(trace), gen.Instance<TValue>(trace));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using TddXt.AnyExtensibility;
using TddXt.CommonTypes;

namespace TddXt.AnyGenerators.Generic
{
Expand All @@ -19,10 +20,10 @@ public class AggregatingGenerator<T> : InlineGenerator<T>
_addOperation = addOperation;
}

public T GenerateInstance(InstanceGenerator instanceGenerator)
public T GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
{
return _generators.Aggregate(_identity,
(current, generator) => _addOperation(current, generator.GenerateInstance(instanceGenerator)));
(current, generator) => _addOperation(current, generator.GenerateInstance(instanceGenerator, trace)));
}
}
}

0 comments on commit 1a23d8e

Please sign in to comment.