Exemple #1
0
        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}");
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }