public void ExtractAssemblyInfo() { var asms = new[] { Assembly.GetExecutingAssembly(), Assembly.GetCallingAssembly() }; foreach(var asm in asms) { if(asm == null) continue; log.Debug("--------------------"); log.Debug("Assembly Name=" + asm.FullName); log.Debug("Assembly Company=" + asm.GetCompany()); log.Debug("Assembly Product=" + asm.GetProduct()); log.Debug("Assembly Description=" + asm.GetDescription()); log.Debug("Assembly Title=" + asm.GetTitle()); log.Debug("Assembly Copyright=" + asm.GetCopyright()); log.Debug("Assembly DefaultAlias=" + asm.GetDefaultAlias()); log.Debug("Assembly Culture=" + asm.GetCulture()); log.Debug("Assembly Configuration=" + asm.GetConfiguration()); log.Debug("Assembly Version=" + asm.GetFileVersion()); log.Debug("Assembly FileVersion=" + asm.GetFileVersion()); log.Debug("Assembly Information Version=" + asm.GetInformationalVersion()); log.Debug("--------------------"); } }
internal static void RegisterWorkScheduling(this Container container, RootCompositionSettings settings) { if (!settings.Flags.HasFlag(RootCompositionFlags.Work)) return; var assemblies = new[] { Assembly.GetAssembly(typeof(IPerformWork<>)) }; // register the work scheduler if (settings.Flags.HasFlag(RootCompositionFlags.Azure)) container.RegisterSingle<IScheduleWork>(() => new AzureBlobWorkScheduler(CloudConfigurationManager.GetSetting(AppSettingsKey.AzureStorageData.ToString()))); else if (settings.Flags.HasFlag(RootCompositionFlags.Web)) container.RegisterSingle<IScheduleWork>(() => new WebDevelopmentWorkScheduler()); // register the work performers container.RegisterManyForOpenGeneric(typeof(IPerformWork<>), container.RegisterAll, assemblies); // retry job on certain exceptions container.RegisterDecorator( typeof(IPerformWork<>), typeof(RetryWorkDecorator<>) ); // wrap the actual performer in another new task (begins new lifetime scope) container.RegisterSingleDecorator( typeof(IPerformWork<>), typeof(PerformWorkAsynchronouslyDecorator<>) ); // decorate the performers with scheduler singletons container.RegisterSingleDecorator( typeof(IPerformWork<>), typeof(PerformWorkOnScheduleDecorator<>) ); }
public Constructor (IClass declaringType, SR.MethodInfo tinfo) { this.declaringType = declaringType; ModifierEnum mod = (ModifierEnum)0; if (tinfo.IsPrivate) mod |= ModifierEnum.Private; if (tinfo.IsAssembly) mod |= ModifierEnum.Internal; if (tinfo.IsFamily) mod |= ModifierEnum.Protected; if (tinfo.IsPublic) mod |= ModifierEnum.Public; if (tinfo.IsAbstract) mod |= ModifierEnum.Abstract; if (tinfo.IsFinal) mod |= ModifierEnum.Sealed; if (tinfo.IsStatic) mod |= ModifierEnum.Static; if (tinfo.IsVirtual) mod |= ModifierEnum.Virtual; modifiers = mod; this.FullyQualifiedName = tinfo.Name; this.region = Class.GetRegion(); this.bodyRegion = Class.GetRegion(); this._member = null; // Add parameters foreach (SR.ParameterInfo pinfo in tinfo.GetParameters()) parameters.Add(new Parameter(this, pinfo, null)); }
public void TestManyModSearch() { var methodName = MethodBase.GetCurrentMethod().Name; TestUtils.ShowStarting(methodName); const string rawFilePath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\TopDown\Lewy_ManyMods\Lewy_intact_01.raw"; const string featureFilePath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\TopDown\Lewy_ManyMods\Lewy_intact_01.ms1ft"; const string databaseFilePath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\TopDown\Lewy_ManyMods\ID_004858_0EE8CF61.fasta"; const string modFilePath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\TopDown\Lewy_ManyMods\Mods.txt"; const string testOutputPath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\TopDown\Lewy_ManyMods\TestOutput"; var args = new[] { "-s", rawFilePath, "-d", databaseFilePath, "-o", testOutputPath, "-m", "1", "-mod", modFilePath, "-tda", "1", "-feature", featureFilePath }; MSPathFinderT.Program.Main(args); }
public void FileEndsWithExtension() { var extensions = new[] { ".txt", ".exe" }; var filenames = new[] { @"C:\text.txt", @"C:\executable.exe", @"C:\image.bmp" }; Assert.That(!SledUtil.StringEndsWithExtension(null, null)); Assert.That(!SledUtil.StringEndsWithExtension(null, extensions)); Assert.That(!SledUtil.StringEndsWithExtension(filenames[0], null)); string out1, out2; Assert.That(!SledUtil.StringEndsWithExtension(null, null, out out1)); Assert.AreEqual(0, string.Compare(string.Empty, out1)); Assert.That(!SledUtil.StringEndsWithExtension(null, extensions, out out1)); Assert.AreEqual(0, string.Compare(string.Empty, out1)); Assert.That(!SledUtil.StringEndsWithExtension(filenames[1], null, out out1)); Assert.AreEqual(0, string.Compare(string.Empty, out1)); Assert.That(SledUtil.StringEndsWithExtension(filenames[0], extensions)); Assert.That(!SledUtil.StringEndsWithExtension(filenames[2], extensions)); Assert.That(SledUtil.StringEndsWithExtension(filenames[1], extensions, out out1)); Assert.That(!SledUtil.StringEndsWithExtension(filenames[2], extensions, out out2)); Assert.AreEqual(0, string.Compare(extensions[1], out1, true)); Assert.AreEqual(0, string.Compare(string.Empty, out2, true)); }
private static void InitializeENode() { ConfigSettings.Initialize(); var assemblies = new[] { Assembly.Load("Forum.QueryServices"), Assembly.Load("Forum.QueryServices.Dapper"), Assembly.Load("Forum.Web") }; Configuration .Create() .UseAutofac() .RegisterCommonComponents() .UseLog4Net() .UseJsonNet() .CreateENode() .RegisterENodeComponents() .RegisterBusinessComponents(assemblies) .SetProviders() .UseEQueue() .InitializeBusinessAssemblies(assemblies) .StartEQueue(); RegisterControllers(); }
private void InitializeENode() { var assemblies = new[] { Assembly.Load("Int.AC"), Assembly.Load("Int.AC.CommandHandlers"), Assembly.Load("Int.AC.ReadModel"), Assembly.Load("Int.UITest") }; string dbConfig = System.Configuration.ConfigurationManager.ConnectionStrings["IntDbConn"].ConnectionString; var setting = new ConfigurationSetting { SqlServerDefaultConnectionString = dbConfig }; _enodeConfiguration = _ecommonConfiguration .CreateENode(setting) .RegisterENodeComponents() .RegisterBusinessComponents(assemblies) .UseSqlServerCommandStore() .UseSqlServerEventStore() .UseEQueue() .InitializeBusinessAssemblies(assemblies) .StartENode(NodeType.CommandProcessor | NodeType.EventProcessor | NodeType.ExceptionProcessor) .StartEQueue(); RegisterControllers(); _logger.Info("ENode initialized."); }
private void InitializeENode() { ConfigSettings.Initialize(); var assemblies = new[] { Assembly.Load("Registration.Commands"), Assembly.Load("Registration.Domain"), Assembly.Load("Registration.ReadModel"), Assembly.Load("Payments.Commands"), Assembly.Load("Payments.ReadModel"), Assembly.GetExecutingAssembly() }; _enodeConfiguration = _ecommonConfiguration .CreateENode() .RegisterENodeComponents() .RegisterBusinessComponents(assemblies) .UseEQueue() .InitializeBusinessAssemblies(assemblies) .StartEQueue(); RegisterControllers(); _logger.Info("ENode initialized."); }
public Field (Class declaringType, SR.FieldInfo tinfo) { this.declaringType = declaringType; ModifierEnum mod = (ModifierEnum)0; if (tinfo.IsPrivate) mod |= ModifierEnum.Private; if (tinfo.IsAssembly) mod |= ModifierEnum.Internal; if (tinfo.IsFamily) mod |= ModifierEnum.Protected; if (tinfo.IsPublic) mod |= ModifierEnum.Public; if (tinfo.IsStatic) mod |= ModifierEnum.Static; if (tinfo.IsLiteral) mod |= ModifierEnum.Const; modifiers = mod; this.FullyQualifiedName = tinfo.Name; returnType = new ReturnType(tinfo.FieldType); this.region = Class.GetRegion(); LoadXml (declaringType); }
public Parameter (IMember declaringMember, SR.ParameterInfo pinfo, XmlNode docNode) { this.name = pinfo.Name; returnType = new ReturnType(pinfo.ParameterType); this.declaringMember = declaringMember; try { LoadXml (docNode); } catch { } }
public void ShouldRenderReportWithMultipleAssemblies() { var assemblyToReportOn = new[] { Assembly.GetAssembly(typeof (SomeThing)), Assembly.GetAssembly(typeof (Mango)) }; Approvals.Verify(TechDebtReporter.GenerateReport(assemblyToReportOn)); }
public static void RegisterProfiles() { var assemblies = new[] { Assembly.GetAssembly(typeof(GeoPlanetProfiler)), Assembly.GetAssembly(typeof(WebApiApplication)), }; AutoProfiler.RegisterProfiles(assemblies); Mapper.AssertConfigurationIsValid(); }
public void Install(IWindsorContainer container, IConfigurationStore store) { Assembly serviceAssembly = typeof(DroneService).Assembly; Assembly[] mapperAssemblies = new[] { typeof(DroneLogDto).Assembly }; container.Install( new WcfInstaller(serviceAssembly), new AutoMapperInstaller(mapperAssemblies), new DomainInstaller() ); }
public void TestMichiganGeoRefToWebMercator() { var src = CoordinateSystemFactory.CreateFromWkt(wkt7151); var tgt = CoordinateSystems.ProjectedCoordinateSystem.WebMercator; ICoordinateTransformation transform = null; Assert.DoesNotThrow(() => transform = CoordinateTransformationFactory.CreateFromCoordinateSystems(src, tgt)); Assert.IsNotNull(transform); var ptSrc = new[] {535247.9375, 324548.09375}; double[] ptTgt = null; Assert.DoesNotThrow(() => ptTgt = transform.MathTransform.Transform(ptSrc)); Assert.IsNotNull(ptTgt); }
public void NullableProperties() { var fooArray1 = new[] { new Foo("Bar"), new Foo(null), new Foo("Baz") }; this.PropertyBag.Add("List", fooArray1); var expected = "<?xml version=\"1.0\" ?>\r\n" + @"<html> <h1>BarBaz</h1> </html>"; // should not raise null exception ProcessView_StripRailsExtension("Home/nullableProperties.rails"); AssertReplyEqualTo(expected); }
public CompositionRootFixture() { HttpContext.Current = null; Container = new Container(); var assemblies = new[] { Assembly.GetExecutingAssembly() }; var settings = new RootCompositionSettings { FluentValidatorAssemblies = assemblies, QueryHandlerAssemblies = assemblies, CommandHandlerAssemblies = assemblies, }; Container.ComposeRoot(settings); }
public Property (Class declaringType, SR.PropertyInfo tinfo) { this.declaringType = declaringType; ModifierEnum mod = (ModifierEnum)0; modifiers = mod; this.FullyQualifiedName = tinfo.Name; returnType = new ReturnType(tinfo.PropertyType); this.region = Class.GetRegion(); this.bodyRegion = Class.GetRegion(); LoadXml (declaringType); }
public void SutReferencesOnlySpecifiedAssemblies() { var assemblies = new[] { Assembly.Load("mscorlib"), Assembly.Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), Assembly.Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), Assembly.Load("Ploeh.Albedo"), Assembly.Load("Ploeh.AutoFixture"), Assembly.Load("Mono.Reflection") }; new RestrictiveReferenceAssertion(assemblies) .Verify(Assembly.Load("Jwc.Experiment.Idioms")); }
public void Given_Two_Node_Property_Chain_Then_Gets_MemberInfos() { // Arrange var expected = new[] { typeof(Outter).GetProperty("InnerProperty"), typeof(Inner).GetProperty("Property") }; // Act var res = ExpressionHelpers.UnflattenMemberNamesToMemberInfos(typeof(Outter), "InnerPropertyProperty"); // Assert Assert.AreEqual(expected, res); }
public void Initialize() { var assemblies = new[] { Assembly.GetExecutingAssembly() }; Configuration .Create() .UseAutofac() .RegisterFrameworkComponents() .RegisterBusinessComponents(assemblies) .UseLog4Net() .UseJsonNet() .CreateAllDefaultProcessors() .Initialize(assemblies) .Start(); }
public static void Register() { var assemblies = new[] { Assembly.GetExecutingAssembly(), // ui Assembly.GetAssembly(typeof(CommonModule)), // common Assembly.GetAssembly(typeof(AppContext)), // services Assembly.GetAssembly(typeof(ModelContainer)), // domain Assembly.GetAssembly(typeof(UserViewRepository<Agent, AgentEditModel>)), Assembly.GetAssembly(typeof(ModelBase)) // adapters }; var shell = new MvcShell(assemblies); shell.Register(); }
public void GetRelativePath() { var basePaths = new[] { @"C:\usr\local\cell", @"C:\usr\local\cell\" }; var absPath1 = @"C:\usr\local\file.txt"; var relPath1 = SledUtil.GetRelativePath(absPath1, basePaths[0]); var relPath2 = SledUtil.GetRelativePath(absPath1, basePaths[1]); var relPath3 = @"..\file.txt"; Assert.That( (string.Compare(relPath1, relPath2) == 0) && (string.Compare(relPath2, relPath3) == 0) && (string.Compare(relPath3, relPath1) == 0)); absPath1 = @"C:\usr\local\cell\some\sub\directory\file.txt"; relPath1 = SledUtil.GetRelativePath(absPath1, basePaths[0]); relPath2 = SledUtil.GetRelativePath(absPath1, basePaths[1]); relPath3 = @"some\sub\directory\file.txt"; Assert.That( (string.Compare(relPath1, relPath2) == 0) && (string.Compare(relPath2, relPath3) == 0) && (string.Compare(relPath3, relPath1) == 0)); absPath1 = @"D:\usr\local\cell\some\sub\directory\file.txt"; relPath1 = SledUtil.GetRelativePath(absPath1, basePaths[0]); relPath2 = SledUtil.GetRelativePath(absPath1, basePaths[1]); relPath3 = absPath1; Assert.That( (string.Compare(relPath1, relPath2) == 0) && (string.Compare(relPath2, relPath3) == 0) && (string.Compare(relPath3, relPath1) == 0)); absPath1 = @"C:\some\other\completely\different\directory\file.txt"; relPath1 = SledUtil.GetRelativePath(absPath1, basePaths[0]); relPath2 = SledUtil.GetRelativePath(absPath1, basePaths[1]); relPath3 = @"..\..\..\some\other\completely\different\directory\file.txt"; Assert.That( (string.Compare(relPath1, relPath2) == 0) && (string.Compare(relPath2, relPath3) == 0) && (string.Compare(relPath3, relPath1) == 0)); }
public void SutReferencesOnlySpecifiedAssemblies() { var assemblies = new[] { Assembly.Load("mscorlib"), Assembly.Load("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), Assembly.Load("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), Assembly.Load("Ploeh.AutoFixture, Version=3.18.7.0, Culture=neutral, PublicKeyToken=b24654c590009d4f"), Assembly.Load("Ploeh.AutoFixture.Xunit, Version=3.18.7.0, Culture=neutral, PublicKeyToken=b24654c590009d4f"), Assembly.Load("xunit"), Assembly.Load("xunit.extensions") }; new RestrictiveReferenceAssertion(assemblies) .Verify(Assembly.Load("Jwc.Experiment.Xunit")); }
public Indexer (Class declaringType, SR.PropertyInfo tinfo) { this.declaringType = declaringType; ModifierEnum mod = (ModifierEnum)0; modifiers = mod; this.FullyQualifiedName = tinfo.Name; returnType = new ReturnType(tinfo.PropertyType); this.region = Class.GetRegion(); this.bodyRegion = Class.GetRegion(); LoadXml (declaringType); // Add parameters foreach (SR.ParameterInfo pinfo in tinfo.GetIndexParameters()) parameters.Add(new Parameter(this, pinfo, node)); }
public static void Configure() { var container = new Container(); container.Options.DefaultScopedLifestyle = Lifestyle.CreateHybrid(() => container.GetCurrentLifetimeScope() != null, new LifetimeScopeLifestyle(), new WebRequestLifestyle() ); var assemblies = new[] { Assembly.GetExecutingAssembly(), // This Assembly.GetAssembly(typeof (InquiryRequest)), // Domain Assembly.GetAssembly(typeof (CompositionRoot)) // Infrastructure }; // Register the Web Configuration Manager container.Register<IConfigurationManager, WebConfigurationManager>(Lifestyle.Singleton); // Register ScaffoldR in Simple Injector container.RegisterScaffoldR(settings => { settings.EventAssemblies = assemblies; settings.TransactionAssemblies = assemblies; settings.FluentValidationAssemblies = assemblies; settings.ViewModelAssemblies = assemblies; }); // Register the controllers in Simple Injector container.RegisterMvcControllers(Assembly.GetExecutingAssembly()); container.RegisterPackages(assemblies); // Register validation in Simple Injector FluentValidationModelValidatorProvider.Configure(provider => { provider.ValidatorFactory = new SimpleInjectorValidatorFactory(container); provider.AddImplicitRequiredValidator = false; } ); // Verify that the container is all setup container.Verify(); DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container)); }
// .NET core does not contain the GetExecutingAssembly() method so we must pass in a reference to the entry assembly public static void UseInfoEndpoint(this IApplicationBuilder app, AssemblyName entryAssembly) { app.Use(async (context, next) => { if (context.Request.Path.Value.Equals("/info")) { var appInfo = new { Name = entryAssembly.Name, Version = entryAssembly.Version.ToString(3) }; context.Response.Headers.Set("Content-Type", "application/json"); await context.Response.WriteAsync(JsonConvert.SerializeObject(appInfo)); } else { await next(); } }); }
public void TypesFromAssembliesPassedToAssociator() { var matcher = MockRepository.GenerateMock<IDocumentationXmlMatcher>(); var parser = new AssemblyXmlParser(matcher, StubDocModel, StubDocMembers); var assemblies = new[] {typeof(First).Assembly, typeof(AssemblyXmlParserTests).Assembly}; var members = DocMembers(typeof(First), typeof(Second)); StubDocMembers.Stub(x => x.GetMembersForDocumenting(null)) .IgnoreArguments() .Return(members); parser.CreateDocumentModel(assemblies, new[] {""}); matcher.AssertWasCalled( x => x.DocumentMembers(null, null), x => x.IgnoreArguments() .Constraints( CIs.Equal(members), CIs.Anything())); }
private void ConfigureIoC() { var builder = new ContainerBuilder(); var config = GlobalConfiguration.Configuration; var assemblies = new[] { Assembly.GetExecutingAssembly() }; builder.RegisterApiControllers(assemblies); builder.RegisterLogger(); builder.RegisterAssemblyTypes(assemblies) .AsClosedTypesOf(typeof(IMapper<,>)) .AsImplementedInterfaces() .InstancePerDependency(); var container = builder.Build(); config.DependencyResolver = new AutofacWebApiDependencyResolver(container); }
public static void CustomConfiguration(ScenarioDirectory directory, string output) { var scenario = MethodBase.GetCurrentMethod().GetFullName(); "Given a hello world script" .f(() => directory = ScenarioDirectory.Create(scenario) .WriteLine("foo.csx", @"Console.WriteLine(""Hello world!"");")); "And a local config file specfying to run as debug" .f(() => directory.WriteLine("custom.opts", @"{ logLevel: ""debug"" }")); "When I execute the script without the log level option but specifying the custom config" .f(() => { var args = new[] { "-config", "custom.opts", }; output = ScriptCsExe.Run("foo.csx", false, args, directory); }); "Then I see debug messages" .f(() => output.ShouldContain("DEBUG:")); }
private static void InitializeENode() { var assemblies = new[] { Assembly.Load("Forum.Infrastructure"), Assembly.Load("Forum.Commands"), Assembly.Load("Forum.Domain"), Assembly.Load("Forum.Domain.Dapper"), Assembly.Load("Forum.CommandHandlers"), Assembly.Load("Forum.Denormalizers.Dapper"), Assembly.Load("Forum.ProcessManagers"), Assembly.Load("Forum.QueryServices"), Assembly.Load("Forum.QueryServices.Dapper"), Assembly.Load("Forum.Domain.Tests") }; var setting = new ConfigurationSetting { SqlDefaultConnectionString = ConfigSettings.ConnectionString }; Configuration .Create() .UseAutofac() .RegisterCommonComponents() .UseLog4Net() .UseJsonNet() .RegisterUnhandledExceptionHandler() .CreateENode(setting) .RegisterENodeComponents() .RegisterBusinessComponents(assemblies) .UseSqlServerLockService() .UseSqlServerCommandStore() .UseSqlServerEventStore() .UseSqlServerSequenceMessagePublishedVersionStore() .UseSqlServerMessageHandleRecordStore() .UseEQueue() .InitializeBusinessAssemblies(assemblies) .StartEQueue(); }