'ServiceFabric.Mocks.MockStatefulServiceContextFactory' threw an exception.
See original GitHub issueHi,
I am trying to do some very basic unit tests around my SchedulerActor
but I cannot get that working.
private static SchedulerActor CreateActor(ActorId id)
{
Func<ActorService, ActorId, ActorBase> actorFactory = (service, actorId) => new SchedulerActor(service, id);
var svc = MockActorServiceFactory.CreateActorServiceForActor<SchedulerActor>(actorFactory);
var actor = svc.Activate(id);
return actor;
}
The exception message:
System.TypeInitializationException : The type initializer for 'ServiceFabric.Mocks.MockStatefulServiceContextFactory' threw an exception.
----> System.TypeLoadException : Method 'ReportApplicationHealth' in type 'ServiceFabric.Mocks.MockCodePackageActivationContext' from assembly 'ServiceFabric.Mocks, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at ServiceFabric.Mocks.MockActorServiceFactory.CreateActorServiceForActor[TActor](Func`3 actorFactory, IActorStateProvider actorStateProvider, StatefulServiceContext context, ActorServiceSettings settings)
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
loekd/ServiceFabric.Mocks
Works by injecting IServiceProxyFactory and/or IActorProxyFactory Mocks into Actors and Services. The factories will create Mock Proxies. Mocking out called ...
Read more >Unit testing in Azure Service Fabric
ServiceFabric.Mocks contains many Mock and helper classes to facilitate and simplify unit testing of Service Fabric Actors and Services. Useful ...
Read more >Writing UnitTests for a Service Fabric Application Class
Mocks library, to create a test instance of your service by using the following code: var serviceInstance = new SearchServiceClass( ...
Read more >Unit testing stateful services in Service Fabric - Azure
These remote resources should be mocked. Mocking in the context of this article will fake, record, and control the return values for remote ......
Read more >Mmm, software: July 2017
Unit testing Service Fabric Reliable Service and Actors with Mocks and Moqs. Install-Package Moq Install-Package ServiceFabric.Mocks
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
can you try using v2.2.2, in that version, more overloads were added
Glad I could help. If you’re good to go, please close the issue.