示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            var authConfigModel = Configuration.GetSection("AuthenticateConfiguration").Get <AuthenticateConfigurationModel>();

            services.AddJwtBearerTokenAuthentication(authConfigModel.Secret);

            // register DI
            PsymendContainerFactory.RegisterModules(services);

            ConfigurationModule.Register(services, Configuration);
        }
示例#2
0
            public void Should_Throw_If_Registrar_Are_Null()
            {
                // Given
                var fileSystem  = Substitute.For <IFileSystem>();
                var environment = FakeEnvironment.CreateUnixEnvironment();
                var provider    = new CakeConfigurationProvider(fileSystem, environment);
                var options     = new CakeOptions();
                var module      = new ConfigurationModule(provider, options);

                // When
                var result = Record.Exception(() => module.Register(null));

                // Then
                AssertEx.IsArgumentNullException(result, "registrar");
            }
示例#3
0
            public void Should_Use_The_Script_Directory_As_Root_For_Configuration_File()
            {
                // Given
                var fileSystem  = Substitute.For <IFileSystem>();
                var environment = FakeEnvironment.CreateUnixEnvironment();
                var provider    = new CakeConfigurationProvider(fileSystem, environment);
                var registry    = new ContainerRegistrar();
                var options     = new CakeOptions {
                    Script = "./foo/bar/build.cake"
                };
                var module = new ConfigurationModule(provider, options);

                // When
                module.Register(registry);

                // Then
                fileSystem.Received(1).Exist(Arg.Is <FilePath>(f => f.FullPath == "/Working/foo/bar/cake.config"));
            }