public void LoggerService_ValidateEntry()
        {
            LogEntry logEntry = new LogEntry("Test", "TestCategory", 1, 12, TraceEventType.Verbose, "Test Title");
            var      actual   = new MockLoggerService();

            Assert.IsTrue(actual.ValidateEntry(logEntry));
        }
        public void LoggerService_CollectEntries_Single_TraceEntry()
        {
            Entry[] entries = { new TraceEntry() };
            var     actual  = new MockLoggerService();

            actual.LogEntries(entries);
            Assert.AreEqual(1, actual.TraceCount);
            Assert.IsTrue(actual.TraceEntryCollection);
        }
        public void LoggerService_CollectEntries_Three_Mix()
        {
            Entry[] entries = { new LogEntry(), new LogEntry(), new TraceEntry() };
            var     actual  = new MockLoggerService();

            actual.LogEntries(entries);
            Assert.AreEqual(2, actual.LogCount);
            Assert.AreEqual(1, actual.TraceCount);
            Assert.AreEqual(3, actual.TotalCount);
            Assert.IsTrue(actual.MixEntryCollection);
        }
示例#4
0
        protected void Application_Start()
        {
            ///////////////////////////////
            // 1. Load Services

            var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;

            // ** Logger **
            ILoggerService logger = new MockLoggerService(); //Using Mock for now

            ServiceProvider.Initialization(logger);
            ServiceProvider.LoggerService.Logger.Debug("Module Loaded: Logger");

            // ** DAL **
            //Load configs
            GeneralConfig dalConfig = new GeneralConfig(Path.Combine(baseDirectory, "Dal.Config.xml"));


            EntityContext entityContext = new EntityContext(dalConfig.GetParam("SqlDatabaseConnection"));

            ServiceProvider.Initialization(entityContext);
            ServiceProvider.LoggerService.Logger.Debug("Module Loaded: DAL");

            ///////////////////////////////
            // 2. JSON formatter setting
            var formatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;

            formatter.SerializerSettings = new JsonSerializerSettings
            {
                Formatting       = Formatting.Indented,
                TypeNameHandling = TypeNameHandling.Objects,
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            ///////////////////////////////
            // 3. ASP.NET Configurations loading
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var version = Assembly.GetExecutingAssembly().GetName().Version;

            ServiceProvider.LoggerService.Logger.Info($"Application Start. V{version}");
        }
 public void SetUp()
 {
     this.dataProvider  = new MockAssetsDataProvider();
     this.loggerService = new MockLoggerService();
 }
示例#6
0
 public void SetUp()
 {
     this.loggerService = new MockLoggerService();
 }