Exemplo n.º 1
0
        // 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_3_0)
            .AddMvcOptions(o => o.EnableEndpointRouting = false);

            services.AddControllers()
            .AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.Converters.Add(new StringEnumConverter());
            });

            services.AddVersioning();

            var auditoriumLayoutRepository = new AuditoriumLayoutRepository();

            services.AddSingleton <IProvideAuditoriumLayouts>(auditoriumLayoutRepository);

            var openApiContact = new OpenApiContact
            {
                Name  = ApiContactName,
                Email = ApiContactEmail
            };

            var swaggerTitle = $"{GetType().Assembly.GetCustomAttribute<AssemblyProductAttribute>().Product}";

            services.AddSwaggerGen(o =>
                                   o.IncludeXmlComments(
                                       $"{Path.Combine(AppContext.BaseDirectory, Assembly.GetExecutingAssembly().GetName().Name)}.xml"));

            services.AddSwaggerGeneration(openApiContact, swaggerTitle, GetType());
        }
Exemplo n.º 2
0
        public async Task Allow_us_to_retrieve_AuditoriumLayout_for_a_given_ShowId()
        {
            var auditoriumLayoutRepository = new AuditoriumLayoutRepository();
            var auditoriumDto = await auditoriumLayoutRepository.GetAuditoriumSeatingFor("2");

            Check.That(auditoriumDto.Rows).HasSize(6);
            Check.That(auditoriumDto.Corridors).HasSize(2);
            var firstSeatOfFirstRow = auditoriumDto.Rows["A"][0];

            Check.That(firstSeatOfFirstRow.Category).IsEqualTo(2);
        }
        public void Allow_us_to_retrieve_AuditoriumLayout_for_a_given_ShowId()
        {
            var eventRepository = new AuditoriumLayoutRepository();
            var theaterDto      = eventRepository.GetAuditoriumLayoutFor(showId: "2");

            Check.That(theaterDto.Rows).HasSize(6);
            Check.That(theaterDto.Corridors).HasSize(2);
            var firstSeatOfFirstRow = theaterDto.Rows["A"][0];

            Check.That(firstSeatOfFirstRow.Category).IsEqualTo(2);
        }
Exemplo n.º 4
0
        // 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_1);

            var auditoriumLayoutRepository = new AuditoriumLayoutRepository();

            services.AddSingleton <IKnowShowIds>(auditoriumLayoutRepository);
            services.AddSingleton <IKnowAuditoriumLayouts>(auditoriumLayoutRepository);

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info {
                    Title = "AuditoriumLayout", Version = "v1"
                }); });
        }