Skip to content

Commit

Permalink
Clean up Operators and Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtule committed Jul 7, 2017
1 parent 162b790 commit c92d7cd
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 164 deletions.
3 changes: 3 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ build_script:

test: off

artifacts:
- path: '**\bin\*\*.nupkg'

skip_branch_with_pr: true
17 changes: 0 additions & 17 deletions .ci/codebetterci.proj

This file was deleted.

15 changes: 0 additions & 15 deletions .ci/nunit.sh

This file was deleted.

8 changes: 2 additions & 6 deletions Dynamitey/Dynamic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,10 @@ public static dynamic InvokeUnaryOpartor(ExpressionType op, dynamic arg)
return !arg;
case ExpressionType.Negate:
return -arg;
case ExpressionType.PreDecrementAssign:
case ExpressionType.Decrement:
return --arg;
case ExpressionType.PreIncrementAssign:
case ExpressionType.Increment:
return ++arg;
case ExpressionType.PostDecrementAssign:
return arg--;
case ExpressionType.PostIncrementAssign:
return arg++;
default:
throw new ArgumentException("Unsupported Operator", "op");
}
Expand Down
6 changes: 3 additions & 3 deletions Dynamitey/Dynamitey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Company>Ekon Benefits</Company>
<Authors />
<Copyright>Copyright 2017 Ekon Benefits</Copyright>
<AssemblyVersion>2.0.1.0</AssemblyVersion>
<FileVersion>2.0.1.0</FileVersion>
<AssemblyVersion>2.0.2.0</AssemblyVersion>
<FileVersion>2.0.2.0</FileVersion>
<PackageProjectUrl>https://github.com/ekonbenefits/dynamitey</PackageProjectUrl>
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<PackageTags>dynamic metaprogramming dlr reflection currying tuples expando latetypes</PackageTags>
Expand All @@ -18,7 +18,7 @@
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>sn.snk</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign>
<Version>2.0.1-alpha</Version>
<Version>2.0.2-alpha</Version>

</PropertyGroup>

Expand Down
58 changes: 49 additions & 9 deletions Tests/Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,9 +1360,9 @@ private DynamicObject CreateMock(ExpressionType op)
return tMock.Object;
}

public class BinaryTestDynObject:DynamicObject{
public class OperatorTestDynObject:DynamicObject{
ExpressionType _type;
public BinaryTestDynObject(ExpressionType type){
public OperatorTestDynObject(ExpressionType type){
_type = type;
}

Expand All @@ -1372,28 +1372,68 @@ public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg
return true;
}

public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result){
Assert.AreEqual(_type, binder.Operation);
result = _type;
return true;
}

}
private void RunMockTests(ExpressionType type){
var mock = new BinaryTestDynObject(type);
private void RunBinaryMockTests(ExpressionType type){
var mock = new OperatorTestDynObject(type);
var dummy = new Object();
Dynamic.InvokeBinaryOperator(mock, type, dummy);
}

private void RunUnaryMockTests(ExpressionType type){
var mock = new OperatorTestDynObject(type);
Dynamic.InvokeUnaryOpartor(type,mock);
}

[Test]
public void TestInvokeAdd()
{
Assert.AreEqual(Dynamic.InvokeBinaryOperator(1, ExpressionType.Add, 2), 3);
}


[Test]
public void TestInvokeBasicUnaryOperatorsDynamic()
{
RunUnaryMockTests(ExpressionType.Not);
RunUnaryMockTests(ExpressionType.Negate);
RunUnaryMockTests(ExpressionType.Increment);
RunUnaryMockTests(ExpressionType.Decrement);



}

[Test]
public void TestInvokeBasicBinaryOperatorsDynamic()
{
RunMockTests(ExpressionType.Add);
RunMockTests(ExpressionType.Subtract);
RunMockTests(ExpressionType.Divide);
RunMockTests(ExpressionType.Multiply);
RunBinaryMockTests(ExpressionType.Add);
RunBinaryMockTests(ExpressionType.Subtract);
RunBinaryMockTests(ExpressionType.Divide);
RunBinaryMockTests(ExpressionType.Multiply);
RunBinaryMockTests(ExpressionType.Modulo);

RunBinaryMockTests(ExpressionType.And);
RunBinaryMockTests(ExpressionType.Or);
RunBinaryMockTests(ExpressionType.ExclusiveOr);
RunBinaryMockTests(ExpressionType.LeftShift);
RunBinaryMockTests(ExpressionType.RightShift);

RunBinaryMockTests(ExpressionType.AddAssign);
RunBinaryMockTests(ExpressionType.SubtractAssign);
RunBinaryMockTests(ExpressionType.DivideAssign);
RunBinaryMockTests(ExpressionType.MultiplyAssign);
RunBinaryMockTests(ExpressionType.ModuloAssign);

RunBinaryMockTests(ExpressionType.AndAssign);
RunBinaryMockTests(ExpressionType.OrAssign);
RunBinaryMockTests(ExpressionType.ExclusiveOrAssign);
RunBinaryMockTests(ExpressionType.LeftShiftAssign);
RunBinaryMockTests(ExpressionType.RightShiftAssign);
}


Expand Down
17 changes: 0 additions & 17 deletions dist/build.proj

This file was deleted.

47 changes: 0 additions & 47 deletions dist/create-nuget.ps1

This file was deleted.

14 changes: 0 additions & 14 deletions dist/net40.targets

This file was deleted.

25 changes: 0 additions & 25 deletions dist/nunit-console.exe.config

This file was deleted.

11 changes: 0 additions & 11 deletions dist/publish-nuget.bat

This file was deleted.

0 comments on commit c92d7cd

Please sign in to comment.