diff --git a/.appveyor.yml b/.appveyor.yml index 6e030eb..7f1cdb3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,4 +8,7 @@ build_script: test: off +artifacts: + - path: '**\bin\*\*.nupkg' + skip_branch_with_pr: true diff --git a/.ci/codebetterci.proj b/.ci/codebetterci.proj deleted file mode 100644 index 8e26ada..0000000 --- a/.ci/codebetterci.proj +++ /dev/null @@ -1,17 +0,0 @@ - - - - Dynamitey - - - - Configuration=Release;UseOldPcl=true; - - - Configuration=Release;OutputPath=bin\Release.net40\;IntermediateOutputPath=obj\Release.net40\;UseNet40=true; - - - - - - \ No newline at end of file diff --git a/.ci/nunit.sh b/.ci/nunit.sh deleted file mode 100755 index 44e428c..0000000 --- a/.ci/nunit.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -x - -mono --runtime=v4.0 .nuget/NuGet.exe install NUnit.Runners -Version 2.6.1 -o packages - -runTest(){ - mono --runtime=v4.0 packages/NUnit.Runners.2.6.1/tools/nunit-console.exe -noxml -nodots -labels -stoponerror $@ - if [ $? -ne 0 ] - then - exit 1 - fi -} - -runTest $1 -exclude=Performance - -exit $? \ No newline at end of file diff --git a/Dynamitey/Dynamic.cs b/Dynamitey/Dynamic.cs index decf983..b607ebd 100644 --- a/Dynamitey/Dynamic.cs +++ b/Dynamitey/Dynamic.cs @@ -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"); } diff --git a/Dynamitey/Dynamitey.csproj b/Dynamitey/Dynamitey.csproj index c6de0cc..eed53de 100644 --- a/Dynamitey/Dynamitey.csproj +++ b/Dynamitey/Dynamitey.csproj @@ -6,8 +6,8 @@ Ekon Benefits Copyright 2017 Ekon Benefits - 2.0.1.0 - 2.0.1.0 + 2.0.2.0 + 2.0.2.0 https://github.com/ekonbenefits/dynamitey http://www.apache.org/licenses/LICENSE-2.0 dynamic metaprogramming dlr reflection currying tuples expando latetypes @@ -18,7 +18,7 @@ True sn.snk False - 2.0.1-alpha + 2.0.2-alpha diff --git a/Tests/Invoke.cs b/Tests/Invoke.cs index c7f76c7..a23adfe 100644 --- a/Tests/Invoke.cs +++ b/Tests/Invoke.cs @@ -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; } @@ -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); } diff --git a/dist/build.proj b/dist/build.proj deleted file mode 100644 index 57a8a68..0000000 --- a/dist/build.proj +++ /dev/null @@ -1,17 +0,0 @@ - - - - MySolution - - - - Configuration=Release; - - - Configuration=Release;OutputPath=bin\Release.net40\;IntermediateOutputPath=obj\Release.net40\;UseNet40=true; - - - - - - \ No newline at end of file diff --git a/dist/create-nuget.ps1 b/dist/create-nuget.ps1 deleted file mode 100644 index c36073c..0000000 --- a/dist/create-nuget.ps1 +++ /dev/null @@ -1,47 +0,0 @@ -try{ - - $solname = "Dynamitey" - $testname = "Tests" - $projectname = $solname - $projecttype ="csproj" - - #Build PCL and .NET version from one project using msbuild script - C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.proj /p:solname=$solname - - if (!$?){ - throw $error[0].Exception - } - - #Download and configure Nunit test runner - ..\.nuget\nuget.exe install NUnit.Runners -Version 2.6.2 -o ..\packages - Copy-Item nunit-console.exe.config ..\packages\NUnit.Runners.2.6.2\tools\ - - if (!$?){ - throw $error[0].Exception - } - - #Test .net 40 - Echo "Testing Net40" - ..\packages\NUnit.Runners.2.6.2\tools\nunit-console.exe /framework:net-4.0 /noxml /nodots /labels /stoponerror /exclude=Performance ..\$testname\bin\Release.net40\$testname.dll - - if (!$?){ - throw $error[0].Exception - } - - #Test portable - Echo "Testing Portable" - ..\packages\NUnit.Runners.2.6.2\tools\nunit-console.exe /framework:net-4.5 /noxml /nodots /labels /stoponerror /exclude=Performance ..\$testname\bin\Release\$testname.dll - - if (!$?){ - throw $error[0].Exception - } - - -}catch{ - Echo "Build Failed" - exit -} - -#if successful create nuget package -..\.nuget\nuget.exe pack ..\$projectname\$projectname.$projecttype -Properties Configuration=Release -Symbols -Echo "Nuget Success" \ No newline at end of file diff --git a/dist/net40.targets b/dist/net40.targets deleted file mode 100644 index fd59319..0000000 --- a/dist/net40.targets +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dist/nunit-console.exe.config b/dist/nunit-console.exe.config deleted file mode 100644 index 0b42fdb..0000000 --- a/dist/nunit-console.exe.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/dist/publish-nuget.bat b/dist/publish-nuget.bat deleted file mode 100644 index 27a371d..0000000 --- a/dist/publish-nuget.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -IF %2.==. GOTO WrongArgs - -set SYMBOLSOURCE="http://nuget.gw.symbolsource.org/Public/NuGet" - -..\.nuget\nuget.exe push %1.nupkg %2 -..\.nuget\nuget.exe push %1.symbols.nupkg %2 -source %SYMBOLSOURCE% - -GOTO:EOF -:WrongArgs -ECHO "publish-nuget " \ No newline at end of file