Пример #1
0
        static void Main()
        {
            Settings.Initialize();
            NewRelicConfiguration.Initialize();

            var levelSwitch = new LoggingLevelSwitch();
            var logger      = new LoggerConfiguration().MinimumLevel.ControlledBy(levelSwitch).WriteTo.Logentries(Settings.LoggingConfig.LogentriesKey).CreateLogger();

            Log.Logger = logger;

            Console.WriteLine("Starting email webjob");
            Log.Information("Starting email webjob");

            ConfigurationLoader.Initialize();
            TemplateConfiguration.Initialize();
            var container = new ContainerBuilder();

            WebJobRegistration.Initialize(container);

            var config = new JobHostConfiguration
            {
                JobActivator = new WebJobActivator(container.Build()),
                Tracing      = { ConsoleLevel = TraceLevel.Info }
            };

            config.UseServiceBus();

            var host = new JobHost(config);

            host.RunAndBlock();

            Console.WriteLine("Successfully started email webjob");
        }
        public void ShouldConvertTemplateToStalk()
        {
            var data = "<eyeinthesky><templates><template /></templates></eyeinthesky>";

            this.fileService.Setup(x => x.GetReadableStream(It.IsAny <string>()))
            .Returns(new MemoryStream(Encoding.UTF8.GetBytes(data)));

            var tpl = new Template("flag", null, true, true, null, DateTime.MinValue, null, "<true />", "#meta");

            this.templateFact.Setup(x => x.NewFromXmlElement(It.IsAny <XmlElement>())).Returns(tpl);
            this.stalkNodeFact.Setup(x => x.NewFromXmlFragment(It.IsAny <XmlElement>())).Returns(new TrueNode());

            var templateConfig = new TemplateConfiguration(
                this.AppConfigMock.Object,
                this.LoggerMock.Object,
                this.templateFact.Object,
                this.commandParser.Object,
                this.stalkNodeFact.Object,
                this.fileService.Object
                );

            templateConfig.Initialize();

            // act
            var result = templateConfig.NewFromTemplate("stalk", tpl, new List <string>());

            // assert
            Assert.NotNull(result);
            Assert.IsInstanceOf <IStalk>(result);
            Assert.AreEqual("stalk", result.Identifier);
            Assert.IsInstanceOf <TrueNode>(result.SearchTree);
            Assert.AreEqual("#meta", result.WatchChannel);
        }
Пример #3
0
 public EmailTests()
 {
     Settings.Initialize();
     TemplateConfiguration.Initialize();
     _cultureService = new CultureService();
     _mailService    = new MailService(_cultureService);
     _workorder      = CreateWorkorderMock();
     _equipment      = CreateEquipmentMock();
     _sublocation    = CreateSublocationMock();
     _eventMonitor   = CreateEventMonitorMock();
 }