Skip to content

Commit

Permalink
Add inherited interface to code generator. #27
Browse files Browse the repository at this point in the history
  • Loading branch information
veblush committed Jun 5, 2016
1 parent 4de0054 commit 266a62f
Show file tree
Hide file tree
Showing 7 changed files with 645 additions and 90 deletions.
1 change: 1 addition & 0 deletions core/Akka.Interfaced.Tests/Akka.Interfaced.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<Compile Include="ExceptionHandle.Notification.cs" />
<Compile Include="ExceptionHandle.Request.cs" />
<Compile Include="ExceptionHandle.StartStop.cs" />
<Compile Include="Inheritance.cs" />
<Compile Include="Interface\IBasic.cs" />
<Compile Include="Interface\IDummy.cs" />
<Compile Include="Interface\IOverloaded.cs" />
Expand Down
53 changes: 53 additions & 0 deletions core/Akka.Interfaced.Tests/Inheritance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Interfaced.Tests
{
public class DummyFinalActor : InterfacedActor, IDummyExFinal
{
public DummyFinalActor()
{
}

Task<object> IDummy.Call(object param)
{
return Task.FromResult<object>("Call:" + param);
}

Task<object> IDummyEx.CallEx(object param)
{
return Task.FromResult<object>("CallEx:" + param);
}

Task<object> IDummyEx2.CallEx2(object param)
{
return Task.FromResult<object>("CallEx2:" + param);
}

Task<object> IDummyExFinal.CallExFinal(object param)
{
return Task.FromResult<object>("CallExFinal:" + param);
}
}

public class InheritanceTest : Akka.TestKit.Xunit2.TestKit
{
public InheritanceTest(ITestOutputHelper output)
: base(output: output)
{
}

[Fact]
public async Task Test_InheritedInterfacedActor_Work()
{
var actor = ActorOfAsTestActorRef<DummyFinalActor>();
var a = new DummyExFinalRef(actor);
Assert.Equal("Call:1", await a.Call("1"));
Assert.Equal("CallEx:1", await a.CallEx("1"));
Assert.Equal("CallEx2:1", await a.CallEx2("1"));
Assert.Equal("CallExFinal:1", await a.CallExFinal("1"));
}
}
}
15 changes: 15 additions & 0 deletions core/Akka.Interfaced.Tests/Interface/IDummy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,19 @@ public interface IDummy : IInterfacedActor
{
Task<object> Call(object param);
}

public interface IDummyEx : IDummy
{
Task<object> CallEx(object param);
}

public interface IDummyEx2 : IDummy
{
Task<object> CallEx2(object param);
}

public interface IDummyExFinal : IDummyEx, IDummyEx2
{
Task<object> CallExFinal(object param);
}
}
5 changes: 5 additions & 0 deletions core/Akka.Interfaced.Tests/Interface/ISubjectObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public interface ISubject2Observer : IInterfacedObserver
void Event(string eventName);
void Event2(string eventName);
}

public interface ISubjectExObserver : ISubjectObserver
{
void EventEx(string eventName);
}
}

0 comments on commit 266a62f

Please sign in to comment.