示例#1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     MvcConfig.Setup();
     DependencyConfig.Setup();
 }
示例#2
0
        public static void UploadProject(this ICakeContext context, UploadProjectArgs args)
        {
            DependencyConfig.Setup(args, context).GetAwaiter().GetResult();
            var cmd = DependencyConfig.Container.GetService <UploadProjectCommand>();

            cmd.Execute().GetAwaiter().GetResult();
        }
示例#3
0
        public static void ClearTenantConfig(this ICakeContext context, ClearTenantArgs args)
        {
            DependencyConfig.Setup(args, context).GetAwaiter().GetResult();
            var cmd = DependencyConfig.Container.GetService <ClearTenantCommand>();

            cmd.Execute().GetAwaiter().GetResult();
        }
        public async Task ClearTenantArgsAddedAndSubTypes(Mock <IServiceCollection> mockColl, ClearTenantArgs args)
        {
            await DependencyConfig.Setup(args, null, mockColl.Object, false).ConfigureAwait(false);

            mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ClearTenantArgs))), Times.Once);
            mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ArgsBase))), Times.Once);
        }
示例#5
0
        public static void ValidateConfig(this ICakeContext context, ValidateArgs args)
        {
            DependencyConfig.Setup(args, context).GetAwaiter().GetResult();
            var cmd = DependencyConfig.Container.GetService <ValidateLibraryCommand>();

            cmd.Execute().GetAwaiter().GetResult();
        }
        public async Task CakeLoggerUsedWhenPresent(Mock <ICakeContext> mockCake, Mock <IServiceCollection> mockColl, ClearVariableSetArgs args)
        {
            await DependencyConfig.Setup(args, mockCake.Object, mockColl.Object, false).ConfigureAwait(false);

            mockCake.Verify(m => m.Log, Times.Once);
            mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ILogger) && ((CakeLoggerAbstraction)s.ImplementationInstance)._cakeLogger != null)), Times.Once);
        }
示例#7
0
        public static void UploadEnvironmentVariablesGlob(this ICakeContext context, EnvironmentVarGlobArgs args)
        {
            args.VariableType = VariableType.EnvironmentGlob;
            DependencyConfig.Setup(args, context).GetAwaiter().GetResult();
            var cmd = DependencyConfig.Container.GetService <UploadLibraryCommand>();

            cmd.Execute().GetAwaiter().GetResult();
        }
示例#8
0
        public static void UploadJson(this ICakeContext context, JsonReplacementArgs args)
        {
            args.VariableType = VariableType.JsonConversion;
            DependencyConfig.Setup(args, context).GetAwaiter().GetResult();
            var cmd = DependencyConfig.Container.GetService <UploadLibraryCommand>();

            cmd.Execute().GetAwaiter().GetResult();
        }
        public async Task LibraryTargetArgsAddedAndThrows(Mock <IServiceCollection> mockColl, LibraryTargetArgs args)
        {
            Func <Task> sut = () => DependencyConfig.Setup(args, null, mockColl.Object, false);
            await sut.Should().ThrowAsync <ArgumentException>().ConfigureAwait(false);

            mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(LibraryTargetArgs))), Times.Once);
            mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ArgsBase))), Times.Once);
        }
示例#10
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            DependencyConfig.Setup();

            // Disable HTTP headers to disclose ASP.NET MVC on the server
            MvcHandler.DisableMvcResponseHeader = true;
        }
        /// <summary>
        ///
        /// </summary>
        protected void Application_Start()
        {
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();

            // Register your types, for instance using the scoped lifestyle:
            // Since the interfaces and models exisit in a service project, we will set them up there...
            DependencyConfig.Setup(container);

            container.Verify();



            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
示例#12
0
 public static async Task <int> Main(string[] cmdArgs)
 {
     return(await Parser.Default.ParseArguments <ValidateArgs, ClearVariableSetArgs, LibraryTargetArgs, ValidateTenantArgs, UploadTenantArgs, UploadProjectArgs, ClearProjectArgs, ClearTenantArgs>(cmdArgs)
            .MapResult <ValidateArgs, ClearVariableSetArgs, LibraryTargetArgs, ValidateTenantArgs, UploadTenantArgs, UploadProjectArgs, ClearProjectArgs, ClearTenantArgs, Task <int> >(
                async validateArgs =>
     {
         await DependencyConfig.Setup(validateArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <ValidateLibraryCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                async clearArgs =>
     {
         await DependencyConfig.Setup(clearArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <ClearVariableSetCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                async libArgs =>
     {
         await DependencyConfig.Setup(libArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <UploadLibraryCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                async validateTeanantArgs =>
     {
         await DependencyConfig.Setup(validateTeanantArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <ValidateTenantCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                async uploadTenantArgs =>
     {
         await DependencyConfig.Setup(uploadTenantArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <UploadTenantCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                async uploadProjectArgs =>
     {
         await DependencyConfig.Setup(uploadProjectArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <UploadProjectCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                async clearProjectArgs =>
     {
         await DependencyConfig.Setup(clearProjectArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <ClearProjectCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                async clearTenantArgs =>
     {
         await DependencyConfig.Setup(clearTenantArgs).ConfigureAwait(false);
         var cmd = DependencyConfig.Container.GetService <ClearTenantCommand>();
         await cmd.Execute().ConfigureAwait(false);
         return 0;
     },
                _ => Task.FromResult(1)
                ).ConfigureAwait(false));
 }
示例#13
0
 public void Setup()
 {
     DependencyConfig.Setup();
 }
 public async Task NullOrEmptyApiKeyThrows(string apiKey, Mock <IServiceCollection> mockColl, ArgsBase args)
 {
     args.ApiKey = apiKey;
     Func <Task> sut = () => DependencyConfig.Setup(args, null, mockColl.Object, false);
     await sut.Should().ThrowAsync <ArgumentException>().ConfigureAwait(false);
 }
 public async Task UnknownTypeThrows(Mock <IServiceCollection> mockColl, UnkonwnArgs args)
 {
     Func <Task> sut = () => DependencyConfig.Setup(args, null, mockColl.Object, false);
     await sut.Should().ThrowAsync <ArgumentException>().ConfigureAwait(false);
 }