This may already be answered and I am just not searching for the right keywords but I will ask it again....
Within my Architecture I have 2 Interfaces (one public lets call it ISpecificBlockEntity which implements IBlockEntity, and one internal IBlockEntitySetup).
I then have an object that implements both of these interfaces. Within my code I have the following generic method:
TResult CreateEmptyEntity<TResult>() where TResult : IBlockEntity
var result = DependencyInjector.InjectEntity<TResult>();
var setupEntity = (result
"Entity type requested does not support construction through this method."
result = setupEntity.CreateEmptyEntity<TResult>();
as you can see I don't want the functionality available in IBlockEntitySetup exposed outside of my library so I made that interface internal (the method shown in the entry point into the library).
What I need to do is mock an object for result (which is easy Mock.Create<ISpecificBlockEntity>()), and mock that same object as an IBlockEntitySetup so I can arrange the CreateEmptyEntity method to do nothing (and so setupEntity does not return null).
Here is the unit test for reference....
var mockedTower = Mock.Create<ITowerConfiguration>();
var mockedTowerSetup = mockedTower
Mock.Arrange(() => mockedTowerSetup.CreateEmptyEntity<ITowerConfiguration>()).DoNothing();
Mock.Arrange(() => InjectorMock.InjectEntity<ITowerConfiguration>()).Returns(mockedTowerSetup
This isn't working, it says the profiler must be enabled to mock/asset target IBlockEntitySetup.CreateEmptyEntity() method.
I have also tried replacing mockedTowerSetup with (mockedTower as IBlockEntitySetup) in the arrange statement, but then I get a Not Implemented exception (which is odd since it should be mocked.....).
Debugging for whatever reason isn't working right even with the profiler disabled....
Is there anyway to do this? Am I coming at this from the wrong direction? Any help is greatly appreciated.