Skip to content

Commit

Permalink
All the bits rehomed.
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkcod committed Jul 12, 2020
1 parent c5637b9 commit 73a21e1
Show file tree
Hide file tree
Showing 41 changed files with 65 additions and 66 deletions.
2 changes: 1 addition & 1 deletion Source/Check.That/Check.cs
Expand Up @@ -6,9 +6,9 @@
using System.Reflection;
using CheckThat.Expectations;
using CheckThat.Expressions;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone;
using Cone.Core;

namespace CheckThat
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/BinaryExpect.cs
@@ -1,8 +1,8 @@
using System;
using System.Linq.Expressions;
using System.Reflection;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/BooleanExpect.cs
@@ -1,8 +1,8 @@
using System;
using System.Linq.Expressions;
using System.Reflection;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/ExceptionExpect.cs
@@ -1,7 +1,7 @@
using System;
using System.Linq.Expressions;
using CheckThat.Expressions;
using Cone.Core;
using CheckThat.Formatting;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/ExpectFactory.cs
Expand Up @@ -4,8 +4,8 @@
using System.Linq.Expressions;
using System.Reflection;
using CheckThat.Expressions;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 0 additions & 2 deletions Source/Check.That/Expectations/ExpectMessages.cs
@@ -1,5 +1,3 @@
using Cone.Core;

namespace CheckThat.Expectations
{
public static class ExpectMessages
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/ExpectValue.cs
@@ -1,4 +1,4 @@
using Cone.Core;
using CheckThat.Formatting;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/IExpect.cs
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
using Cone.Core;
using CheckThat.Formatting;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/MemberMethodExpect.cs
@@ -1,7 +1,7 @@
using System.Linq.Expressions;
using System.Reflection;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/NotExpect.cs
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
using Cone.Core;
using CheckThat.Formatting;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/StringEqualExpect.cs
@@ -1,7 +1,7 @@
using System;
using System.Linq.Expressions;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat.Expectations
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/Expectations/StringMethodExpect.cs
Expand Up @@ -3,7 +3,7 @@
using System.Globalization;
using System.Linq.Expressions;
using System.Reflection;
using Cone.Core;
using CheckThat.Formatting;

namespace CheckThat.Expectations
{
Expand Down
Expand Up @@ -5,7 +5,6 @@
using System.Linq.Expressions;
using System.Reflection;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat.Expressions
{
Expand Down
1 change: 0 additions & 1 deletion Source/Check.That/FailedExpectation.cs
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using CheckThat.Expectations;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat
{
Expand Down
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace Cone.Core
namespace CheckThat.Formatting
{
public class ArrayExpressionStringBuilder<T> : ICollectionFormatter<T>
{
Expand Down
Expand Up @@ -6,7 +6,7 @@
using System.Text;
using CheckThat.Internals;

namespace Cone.Core
namespace CheckThat.Formatting
{
public class ExpressionFormatter : IFormatter<Expression>
{
Expand Down
@@ -1,7 +1,7 @@
using System.Collections;
using System.Collections.Generic;

namespace Cone.Core
namespace CheckThat.Formatting
{
public interface ICollectionFormatter<T> : IFormatter<IEnumerable<T>>, IFormatter<IEnumerable>
{
Expand Down
@@ -1,4 +1,4 @@
namespace Cone.Core
namespace CheckThat.Formatting
{
public interface IFormatter<T>
{
Expand Down
Expand Up @@ -3,7 +3,7 @@
using System.Text;
using CheckThat.Internals;

namespace Cone.Core
namespace CheckThat.Formatting
{
public class ParameterFormatter : IFormatter<object>
{
Expand Down
@@ -1,7 +1,7 @@
using System;
using CheckThat.Internals;

namespace Cone.Core
namespace CheckThat.Formatting
{
public class TypeFormatter
{
Expand Down
7 changes: 5 additions & 2 deletions Source/Check.That/Internals/MemberInfoExtensions.cs
Expand Up @@ -11,8 +11,11 @@ static class MemberInfoExtensions

static readonly ConcurrentDictionary<MemberInfo, Getter> getterCache = new ConcurrentDictionary<MemberInfo, Getter>();

public static object GetValue(this MemberInfo self, object target) =>
getterCache.GetOrAdd(self, CreateGetter)(target);
public static object GetValue(this MemberInfo self, object target) {
var get = getterCache.GetOrAdd(self, CreateGetter);
try { return get(target); }
catch(Exception ex) { throw new TargetInvocationException(ex); }
}

static Getter CreateGetter(MemberInfo x) {
var input = Expression.Parameter(typeof(object));
Expand Down
Expand Up @@ -2,20 +2,16 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq.Expressions;
using CheckThat.Internals;

namespace Cone.Core
namespace CheckThat.Internals
{
static class ObjectConverter
{
static readonly ConcurrentDictionary<KeyValuePair<Type, Type>, Func<object, object>> converters = new ConcurrentDictionary<KeyValuePair<Type, Type>,Func<object,object>>();
static readonly Func<object,object> Identity = x => x;

public static object ChangeType(object value, Type to) {
if(value == null)
return null;
return GetConverter(value.GetType(), to)(value);
}
public static object ChangeType(object value, Type to) =>
value == null ? null : GetConverter(value.GetType(), to)(value);

static Func<object, object> GetConverter(Type from, Type to) =>
converters.GetOrAdd(Key(from, to), x => CreateConverter(x.Key, x.Value));
Expand All @@ -28,8 +24,7 @@ static class ObjectConverter
return Expression.Lambda<Func<object, object>>(input.Convert(from).Convert(to).Box(), input).Compile();
}

static KeyValuePair<Type, Type> Key(Type from, Type to) {
return new KeyValuePair<Type,Type>(from, to);
}
static KeyValuePair<Type, Type> Key(Type from, Type to) =>
new KeyValuePair<Type,Type>(from, to);
}
}
2 changes: 1 addition & 1 deletion Source/Check.That/Internals/TypeExtensions.cs
Expand Up @@ -6,7 +6,7 @@ namespace CheckThat.Internals
public static class TypeExtensions
{
public static bool Has<T>(this Type type) =>
type.GetCustomAttribute(type, true) != null;
type.GetCustomAttribute(typeof(T), true) != null;

public static bool HasAny(this Type self, params Type[] attributeTypes) {
var attributes = self.GetCustomAttributes(true);
Expand Down
2 changes: 1 addition & 1 deletion Source/Check.That/NotExpectedExpect.cs
@@ -1,7 +1,7 @@
using System.Linq.Expressions;
using CheckThat.Expectations;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;

namespace CheckThat
{
Expand Down
1 change: 1 addition & 0 deletions Source/Cone.TestAdapter/Cone.TestAdapter.csproj
Expand Up @@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.1.1" PrivateAssets="All" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<ProjectReference Include="..\Check.That\Check.That.csproj" />
<ProjectReference Include="..\Cone\Cone.csproj" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/Cone.Worker/Cone.Worker.csproj
Expand Up @@ -2,7 +2,7 @@
<Import Project="$(SolutionDir)\Cone.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net452;net462;net472;netcoreapp2.0;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>net452;net462;net472;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworkFamily Condition="$(TargetFramework.StartsWith('net4'))">NETFX</TargetFrameworkFamily>
<DefineConstants>$(DefineConstants);$(TargetFrameworkFamily)</DefineConstants>
<ApplicationIcon />
Expand Down
2 changes: 1 addition & 1 deletion Source/Cone/Core/BasicTestNamer.cs
@@ -1,5 +1,5 @@
using System;
using System.Reflection;
using CheckThat.Formatting;

namespace Cone.Core
{
Expand Down
1 change: 1 addition & 0 deletions Source/Cone/Core/ConeStackFrame.cs
@@ -1,6 +1,7 @@
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;

Expand Down
1 change: 1 addition & 0 deletions Source/Cone/Core/ConeTestNamer.cs
Expand Up @@ -2,6 +2,7 @@
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using CheckThat.Formatting;

namespace Cone.Core
{
Expand Down
1 change: 1 addition & 0 deletions Source/Cone/Core/ObjectInspector.cs
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Reflection;
using System.Text;
using CheckThat.Formatting;
using CheckThat.Internals;

namespace Cone.Core
Expand Down
4 changes: 2 additions & 2 deletions Source/Cone/DisplayClassAttribute.cs
@@ -1,9 +1,9 @@
using Cone.Core;
using System;
using CheckThat.Formatting;

namespace Cone
{
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class DisplayClassAttribute : Attribute
{
readonly Type displayClass;
Expand Down
2 changes: 1 addition & 1 deletion Source/dotnet-conesole/dotnet-conesole.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions Specs/Cone.Specs/BinaryExpectSpec.cs
Expand Up @@ -2,9 +2,8 @@
using System.Linq.Expressions;
using CheckThat;
using CheckThat.Expectations;
using CheckThat.Formatting;
using CheckThat.Internals;
using Cone.Core;
using Cone.Expectations;
using Moq;

namespace Cone
Expand Down
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using CheckThat.Formatting;
using Cone;
using Cone.Core;

Expand Down
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using CheckThat;
using System.Runtime.CompilerServices;
using CheckThat.Internals;
using Cone;

namespace Cone.Core
namespace CheckThat.Formatting
{
static class Extensions
{
Expand Down
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using CheckThat;
using Cone;
using Cone.Core;

namespace Cone.Core
namespace CheckThat.Formatting
{
enum DummyEnum { Value }
[Describe(typeof(ParameterFormatter))]
Expand Down
@@ -1,8 +1,7 @@
using System;
using CheckThat;
using Cone;


namespace Cone.Core
namespace CheckThat.Formatting
{
[Describe(typeof(TypeFormatterSpec))]
public class TypeFormatterSpec
Expand Down
6 changes: 3 additions & 3 deletions Specs/Cone.Specs/Cone.Specs.csproj
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net452;;net462;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>net452;net472;netcoreapp2.1</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)'!='netcoreapp2.2'">
<ItemGroup Condition="'$(TargetFramework)'!='netcoreapp2.1'">
<Compile Remove="NetStandard\**" />
<None Include="NetStandard\**" />
<ProjectReference Include="..\..\Source\Cone.TestAdapter\Cone.TestAdapter.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.2'">
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.1'">
<Compile Remove="NetFramework\**" />
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Specs/Cone.Specs/ConeTestNamerSpec.cs
Expand Up @@ -2,6 +2,7 @@
using System.Linq.Expressions;
using System.Reflection;
using CheckThat;
using CheckThat.Formatting;

namespace Cone.Core
{
Expand Down

0 comments on commit 73a21e1

Please sign in to comment.