Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote events don't work for SingleCall services #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CoreRemoting.Tests/RpcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,14 @@ void ClientAction()
Assert.Equal(0, _serverFixture.ServerErrorCount);
}

[Fact]
public void Events_should_work_remotely()
[Theory]
[InlineData("TestService_Singleton_Service")]
[InlineData("TestService_Singleton_Factory")]
[InlineData("TestService_SingleCall_Service")]
[InlineData("TestService_SingleCall_Factory")]
[InlineData("TestService_Scoped_Service")]
[InlineData("TestService_Scoped_Factory")]
public void Events_should_work_remotely(string serviceName)
{
using var ctx = ValidationSyncContext.Install();

Expand All @@ -254,7 +260,7 @@ public void Events_should_work_remotely()

client.Connect();

var proxy = client.CreateProxy<ITestService>();
var proxy = client.CreateProxy<ITestService>(serviceName);

var serviceEventResetEvent = new ManualResetEventSlim(initialState: false);
var customDelegateEventResetEvent = new ManualResetEventSlim(initialState: false);
Expand Down
23 changes: 23 additions & 0 deletions CoreRemoting.Tests/ServerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ public ServerFixture()
factoryDelegate: () => TestService,
lifetime: ServiceLifetime.Singleton);

// Services for event tests
container.RegisterService<ITestService, TestService>(
lifetime: ServiceLifetime.Singleton,
serviceName: "TestService_Singleton_Service");
container.RegisterService<ITestService, TestService>(
lifetime: ServiceLifetime.SingleCall,
serviceName: "TestService_SingleCall_Service");
container.RegisterService<ITestService, TestService>(
lifetime: ServiceLifetime.Scoped,
serviceName: "TestService_Scoped_Service");
container.RegisterService<ITestService>(
factoryDelegate: () => TestService,
lifetime: ServiceLifetime.Singleton,
serviceName: "TestService_Singleton_Factory");
container.RegisterService<ITestService>(
factoryDelegate: () => TestService,
lifetime: ServiceLifetime.SingleCall,
serviceName: "TestService_SingleCall_Factory");
container.RegisterService<ITestService>(
factoryDelegate: () => TestService,
lifetime: ServiceLifetime.Scoped,
serviceName: "TestService_Scoped_Factory");

// Service for async tests
container.RegisterService<IAsyncService, AsyncService>(
lifetime: ServiceLifetime.Singleton);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Documentation: https://github.com/theRainbird/CoreRemoting/wiki
## Facts & features
- Support for cross framework serialization (since version 1.2.0.0)
- Creates proxy objects for remote services at runtime (uses Castle.DynamicProxy under the hood)
- Services can have `SingleCall` or `Singeton` lifetime
- Services can have `SingleCall`, `Singeton`, or `Scoped` lifetime
- Uses duplex TCP network communication by default (based on WatsonTcp library)
- Custom transport channels can be plugged in (Just implement `IServerChannel` and `IClientChannel`)
- Used Bson serialization by default (via Json.NET)
Expand Down
Loading