MiniMock

Minimalistic approach to mocking in .NET

View on GitHub

Indexers

TL;DR

public interface IVersionLibrary
{
    Version this[string key] { get; set; }
}

var versions = new Dictionary<string, Version> { { "current", new Version(2, 0, 0, 0) } };

var versionLibrary = Mock.IVersionLibrary(config => config
        .Indexer(get: key => new Version(2, 0, 0, 0), set: (key, value) => { }) // Overwrites the indexer getter and setter
        .Indexer(values: versions) // Provides a dictionary to retrieve and store versions
);

// Inject into system under test

Please note