Skip to content

Commit

Permalink
greenify tests III
Browse files Browse the repository at this point in the history
  • Loading branch information
Sholtee committed Jun 14, 2020
1 parent 21b26c8 commit bee1568
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
18 changes: 16 additions & 2 deletions SRC/Private/SyntaxFactories/ProxySyntaxFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,25 @@ public EventInterceptorFactory(EventInfo @event, ProxySyntaxFactory<TInterface,
}

/// <summary>
/// () => Target.Event [+|-]= value;
/// () =>
/// {
/// Target.Event [+|-]= value;
/// return null;
/// }
/// </summary>
internal LambdaExpressionSyntax BuildRegister(bool add) => ParenthesizedLambdaExpression
(
RegisterEvent(Event, TARGET, add)
Block
(
ExpressionStatement
(
RegisterEvent(Event, TARGET, add)
),
ReturnStatement
(
LiteralExpression(SyntaxKind.NullLiteralExpression)
)
)
);

/// <summary>
Expand Down
16 changes: 14 additions & 2 deletions TEST/ClsSrc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,25 @@ internal sealed class GeneratedProxy : Solti.Utils.Proxy.SyntaxFactories.Tests.P
{
add
{
this.InvokeTarget = () => this.Target.Event += value;
this.InvokeTarget = () =>
{
this.Target.Event += value;
return null;
}

;
this.Invoke(GeneratedProxy.FEvent0.AddMethod, new System.Object[]{value}, GeneratedProxy.FEvent0);
}

remove
{
this.InvokeTarget = () => this.Target.Event -= value;
this.InvokeTarget = () =>
{
this.Target.Event -= value;
return null;
}

;
this.Invoke(GeneratedProxy.FEvent0.RemoveMethod, new System.Object[]{value}, GeneratedProxy.FEvent0);
}
}
Expand Down
16 changes: 14 additions & 2 deletions TEST/EventSrc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@ event Solti.Utils.Proxy.SyntaxFactories.Tests.ProxySyntaxFactoryTestsBase.TestDe
{
add
{
this.InvokeTarget = () => this.Target.Event += value;
this.InvokeTarget = () =>
{
this.Target.Event += value;
return null;
}

;
this.Invoke(GeneratedProxy.FEvent0.AddMethod, new System.Object[]{value}, GeneratedProxy.FEvent0);
}

remove
{
this.InvokeTarget = () => this.Target.Event -= value;
this.InvokeTarget = () =>
{
this.Target.Event -= value;
return null;
}

;
this.Invoke(GeneratedProxy.FEvent0.RemoveMethod, new System.Object[]{value}, GeneratedProxy.FEvent0);
}
}

0 comments on commit bee1568

Please sign in to comment.