public void ShouldMockPrivateStaticMethodSecondApproach() { // ARRANGE - In an instance of type FooInternalStatic an integer function with name "EchoPrivate" should throw // an Exception if called with an integer argument that equals 10. // NOTE: To interact with internal classes like this, you may need to add [InternalsVisibleTo] attribute inside // the AssemblyInfo.cs Mock.NonPublic.Arrange <int>(typeof(FooInternalStatic), "EchoPrivate", 10).Throws <Exception>(); // ACT FooInternalStatic.Echo(10); }
public void ShouldAssertPrivateStaticMethodSecondApproach() { // ARRANGE - In the static class FooInternalStatic an integer function with name "EchoPrivate" must be called // with an integer argument that equals 10. // NOTE: To interact with internal classes like this, you may need to add [InternalsVisibleTo] attribute inside // the AssemblyInfo.cs Mock.NonPublic.Arrange <int>(typeof(FooInternalStatic), "EchoPrivate", 10).MustBeCalled(); // ACT FooInternalStatic.Echo(10); // ASSERT - This will assert that the EchoPrivate method has been called with the expected argument during the test. Mock.NonPublic.Assert <int>(typeof(FooInternalStatic), "EchoPrivate", 10); }