Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Xunit;
- using Rhino.Mocks;
- namespace Sample.Tests {
- // Extension Method
- public interface ISomeInterface {
- void SomeMethod(int param1);
- }
- public static class Extensions {
- public static ISomeInterface SomeMethod(this ISomeInterface someInterface, string someParam) {
- // do work, then call the defined method in the interface
- someInterface.SomeMethod(1);
- return someInterface;
- }
- }
- public class Class1 {
- // tried to do the following but it errors
- [Fact]
- public void SomeMethod_WithSomeInterface_CallsOtherSomeMethod() {
- const string someParam = "something";
- const int someOtherParam = 1;
- var mock = MockRepository.GenerateMock<ISomeInterface>();
- mock.SomeMethod(someParam);
- mock.AssertWasCalled(x => x.SomeMethod(someOtherParam));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement