Пример #1
0
        public MyFixture5()
        {
            var connection = @"Server=localhost,1433;Database=Movies;Persist Security Info=True;uid=sa;pwd=D1m1tr1s!;ConnectRetryCount=0";

            container_ = new ServiceCollection()
                         .AddDbContext <MoviesContext>(options =>
                                                       options.UseSqlServer(connection))
                         .BuildServiceProvider();

            var webHostBuilder = new WebHostBuilder()
                                 .UseStartup <MoviesApi.Startup>()
                                 .ConfigureTestServices(services =>
            {
                services.AddTransient <IPricingService, FakePricingService>();
            });

            //var mockPricingService = new Mock<IPricingService>();

            //mockPricingService
            //    //.SetReturnsDefault(0M);
            //    .Setup(a => a.DiscountPercentage(It.IsAny<string>()))
            //    .Returns(0M);

            var ts = new TestServer(webHostBuilder);

            Api = RestClient.For <IMoviesApi>(ts.CreateClient());
        }
Пример #2
0
 public MoviesApi_IntegrationTests(MyFixture5 myFixture)
 {
     api_   = myFixture.Api;
     contx_ = myFixture.Resolve <MoviesContext>();
 }
Пример #3
0
 public MoviesService(IMoviesApi moviesApi)
 {
     _moviesApi = moviesApi;
 }