-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fe3cab
commit 80976ee
Showing
4 changed files
with
110 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
| ||
namespace Nixie.Tests.Actors; | ||
|
||
public sealed class FireAndForgetActorStruct : IActorStruct<int> | ||
{ | ||
private readonly Dictionary<int, int> receivedMessages = new(); | ||
|
||
public FireAndForgetActorStruct(IActorContextStruct<FireAndForgetActorStruct, int> _) | ||
{ | ||
|
||
} | ||
|
||
public int GetMessages(int id) | ||
{ | ||
if (receivedMessages.TryGetValue(id, out int number)) | ||
return number; | ||
|
||
return 0; | ||
} | ||
|
||
public void IncrMessage(int id) | ||
{ | ||
if (!receivedMessages.TryGetValue(id, out int value)) | ||
receivedMessages.Add(id, 1); | ||
else | ||
receivedMessages[id] = ++value; | ||
} | ||
|
||
public async Task Receive(int message) | ||
{ | ||
await Task.CompletedTask; | ||
|
||
//Console.WriteLine("hello"); | ||
|
||
IncrMessage(message); | ||
} | ||
} |
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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.002.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nixie", "Nixie.csproj", "{10FB054D-0B49-4734-967A-6F6BBE68837D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{10FB054D-0B49-4734-967A-6F6BBE68837D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{10FB054D-0B49-4734-967A-6F6BBE68837D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{10FB054D-0B49-4734-967A-6F6BBE68837D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{10FB054D-0B49-4734-967A-6F6BBE68837D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {DE891718-4FA7-4333-8F64-6D0133A9D013} | ||
EndGlobalSection | ||
EndGlobal |
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