public void Setup() { path = Path.GetDirectoryName(GetType().Assembly.Location) + "/Mock/HeadToHeadMock.json"; var repository = new TennisRepository(path); readOnlyTennisRepository = repository; writeOnlyTennisRepository = repository; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); var tennisRepository = new TennisRepository(Path.GetDirectoryName(GetType().Assembly.Location) + "/Files/HeadToHead.json"); services.AddSingleton <IReadOnlyTennisRepository>(tennisRepository); services.AddSingleton <IWriteOnlyTennisRepository>(tennisRepository); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info { Title = "Tennis API", Version = "v1" }); }); }