MiniMock

Minimalistic approach to mocking in .NET

View on GitHub

Properties

TL;DR

public interface IVersionLibrary
{
    Version CurrentVersion { get; set; }
}

var versionLibrary = Mock.IVersionLibrary(config => config
    .CurrentVersion(get: () => new Version(major: 2, minor: 0, build: 0, revision: 0), set: version => throw new IndexOutOfRangeException()) // Overwrites the property getter and setter
    .CurrentVersion(value: new Version(major: 2, minor: 0, build: 0, revision: 0)) // Sets the initial version to 2.0.0.0
);

// Inject into system under test

Please note