public void Seconds_returns_other_builder(int value, SampleBuilder otherBuilder) { // Arrange var builder = TimespanBuilder.Create(value, otherBuilder); // Act var result = builder.Seconds(); // Assert Assert.That(result, Is.SameAs(otherBuilder)); }
public void Minutes_can_build_a_matching_timespan(int value, SampleBuilder otherBuilder) { // Arrange var builder = TimespanBuilder.Create(value, otherBuilder); var timespanProvider = (IProvidesTimespan)builder; // Act builder.Minutes(); // Assert Assert.That(timespanProvider.GetTimespan(), Is.EqualTo(TimeSpan.FromMinutes(value))); }
/// <summary> /// Provides a custom/non-default timeout for the API call. This uses a builder of its own to create the timeout. /// </summary> /// <returns>A timeout builder.</returns> /// <param name="value">The numeric number of milliseconds/seconds/minutes for which the timeout will last.</param> public TimespanBuilder <JsonApiBuilder> WithATimeoutOf(int value) { if (timeoutProvider != null) { throw new InvalidOperationException(Resources.ExceptionFormats.CannotSetTimeoutTwice); } var timeoutBuilder = TimespanBuilder.Create(value, this); timeoutProvider = timeoutBuilder; return(timeoutBuilder); }