-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save uncomplete work - ipc contract interface support the cshar…
…p event. (#12)
- Loading branch information
1 parent
67c43fc
commit 2ae431a
Showing
21 changed files
with
497 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using HandyIpc; | ||
using HandyIpcTests.Fixtures; | ||
using HandyIpcTests.Interfaces; | ||
using Xunit; | ||
|
||
namespace HandyIpcTests | ||
{ | ||
[Collection(nameof(CollectionFixture))] | ||
public class EventTypeTest | ||
{ | ||
private readonly NamedPipeFixture _namedPipeFixture; | ||
private readonly SocketFixture _socketFixture; | ||
|
||
public EventTypeTest(NamedPipeFixture namedPipeFixture, SocketFixture socketFixture) | ||
{ | ||
_namedPipeFixture = namedPipeFixture; | ||
_socketFixture = socketFixture; | ||
} | ||
|
||
[Fact] | ||
public async Task TestEventHandler() | ||
{ | ||
int count = 0; | ||
var instance = _socketFixture.Client.Resolve<IEventType>(); | ||
instance.Changed += Instance_Changed; | ||
instance.Changed += (sender, e) => count++; | ||
|
||
instance.RaiseChanged(EventArgs.Empty); | ||
instance.RaiseChanged(EventArgs.Empty); | ||
instance.RaiseChanged(EventArgs.Empty); | ||
instance.RaiseChanged(EventArgs.Empty); | ||
|
||
await Task.Delay(2000); | ||
Assert.Equal(3, count); | ||
} | ||
|
||
private void Instance_Changed(object? sender, EventArgs e) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using HandyIpcTests.Interfaces; | ||
|
||
namespace HandyIpcTests.Implementations | ||
{ | ||
internal class EventType : IEventType | ||
{ | ||
public event EventHandler? Changed; | ||
|
||
public void RaiseChanged(EventArgs e) | ||
{ | ||
Changed?.Invoke(this, e); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using HandyIpc; | ||
|
||
namespace HandyIpcTests.Interfaces | ||
{ | ||
[IpcContract] | ||
public interface IEventType | ||
{ | ||
event EventHandler Changed; | ||
|
||
public void RaiseChanged(EventArgs e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.