-
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
Showing
10 changed files
with
94 additions
and
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
global using static Naninovel.Bindings.Test.Mocks; | ||
using Naninovel.Observing.Test; | ||
|
||
namespace Naninovel.Bindings.Test; | ||
|
||
public static class Mocks | ||
{ | ||
public interface IHandlerSpecifier; | ||
public interface IHandlerOne<T> where T : IHandlerSpecifier; | ||
public interface IHandlerTwo<T> where T : IHandlerSpecifier; | ||
public interface IServiceOneA; | ||
public interface IServiceOneB; | ||
public interface IServiceOneC; | ||
public interface IServiceTwoA; | ||
public interface IServiceTwoB; | ||
public interface IServiceTwoC; | ||
public class HandlerSpecifierA : IHandlerSpecifier; | ||
public class HandlerSpecifierB : IHandlerSpecifier; | ||
public class ServiceOneA : IServiceOneA, IHandlerOne<HandlerSpecifierA>; | ||
public class ServiceOneB : IServiceOneB, IHandlerOne<HandlerSpecifierB>; | ||
public class ServiceOneC : IServiceOneC, IHandlerOne<HandlerSpecifierA>, IHandlerOne<HandlerSpecifierB>; | ||
public class ServiceTwoA : IServiceTwoA, IHandlerTwo<HandlerSpecifierA>; | ||
public class ServiceTwoB : IServiceTwoB, IHandlerTwo<HandlerSpecifierB>; | ||
public class ServiceTwoC : IServiceTwoC, IHandlerTwo<HandlerSpecifierA>, IHandlerTwo<HandlerSpecifierB>; | ||
|
||
public interface IRegistrar | ||
{ | ||
void Register<T> (IHandlerOne<T> handlerOne) where T : IHandlerSpecifier; | ||
void Register<T> (IHandlerTwo<T> handlerOne) where T : IHandlerSpecifier; | ||
} | ||
|
||
public interface IMockGenericObserver<T>; | ||
|
||
public interface IMockNotifier | ||
{ | ||
void Notify (); | ||
Task NotifyAsync (); | ||
} | ||
|
||
public interface IMockObserverService | ||
{ | ||
bool HandleInvoked { get; } | ||
bool HandleAsyncInvoked { get; } | ||
} | ||
|
||
public class MockObserver : IMockObserverService, IMockObserver | ||
{ | ||
public bool HandleInvoked { get; private set; } | ||
public bool HandleAsyncInvoked { get; private set; } | ||
|
||
public void Handle () => HandleInvoked = true; | ||
|
||
public Task HandleAsync () | ||
{ | ||
HandleAsyncInvoked = true; | ||
return Task.CompletedTask; | ||
} | ||
} | ||
|
||
public class MockNotifier (IObserverNotifier<IMockObserver> notifier) : IMockNotifier | ||
{ | ||
public void Notify () => notifier.Notify(o => o.Handle()); | ||
public Task NotifyAsync () => notifier.NotifyAsync(o => o.HandleAsync()); | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
backend/Naninovel.Common.Test/Bindings/Mocks/MockObservers.cs
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
backend/Naninovel.Common.Test/Bindings/Mocks/MockServices.cs
This file was deleted.
Oops, something went wrong.
13 changes: 9 additions & 4 deletions
13
backend/Naninovel.Common.Test/Bridging/Mocks/MockMessages.cs
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
global using static Naninovel.Bridging.Test.MockMessages; | ||
|
||
namespace Naninovel.Bridging.Test; | ||
|
||
public class ClientMessage : IClientMessage; | ||
public class ServerMessage : IServerMessage; | ||
public class ServerMessageA : IServerMessage; | ||
public class ServerMessageB : IServerMessage; | ||
public static class MockMessages | ||
{ | ||
public class ClientMessage : IClientMessage; | ||
public class ServerMessage : IServerMessage; | ||
public class ServerMessageA : IServerMessage; | ||
public class ServerMessageB : IServerMessage; | ||
} |
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