Skip to content

Add next code to register mock and objec with one call #7

Open

Description

@dzmitry-lahoda

This speeds up registering custom mock in base class of test (e.g. MyRepository) and then resolving mock in child to tune base behavior:

  public static class UnityMoqContainerExtensions
    {
        public static IUnityContainer RegisterMock<T>(this IUnityContainer self, Mock<T> mock)
            where T:class
        {
            return self.RegisterInstance(mock).RegisterInstance(mock.Object);
        }
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions