private void TestTimeouts(TimeSpan expected, long?invocationMs, long configuredMs, long?constructorMs) { // The 'configured' value can't be nullable because the injected config // implementation may pass along a default(long) (i.e. 0) if the config value // isn't set, and we need to be prepared for that and not treat it as an actual // timeout. var constructorTs = (constructorMs == null ? (TimeSpan?)null : TimeSpan.FromMilliseconds(constructorMs.Value)); var command = new TestCommand(AnyString, AnyString, AnyString, constructorTs); var mockConfig = new MjolnirConfiguration { IsEnabled = true, IgnoreTimeouts = false, CommandConfigurations = new Dictionary <string, CommandConfiguration> { { command.Name, new CommandConfiguration { Timeout = configuredMs } } } }; var determined = command.DetermineTimeout(mockConfig, invocationMs); Assert.Equal(expected, determined); }