public async Task ShouldChangeClockImplementation() { var now = new Bogus.Faker().Date.Past(); serviceProvider.Change <Clock>(faker => A.CallTo(() => faker.Now()).Returns(now)); var result = await cliente.GetAsync("time"); result.StatusCode.Should().Be(200); var content = await result.Content.ReadAsStringAsync(); content.Should().Be($"{now:yyyy-MM-ddThh:mm:ss}"); }
public static void Change <T>(this IServiceProvider services, Action <Mock <T> > configure) where T : class { var mock = new Mock <T>(); configure.Invoke(mock); services.Change(mock.Object); }
public static void Change <T>(this IServiceProvider services, Action <T> configure) where T : class { var fake = A.Fake <T>(); configure.Invoke(fake); services.Change(fake); }