Exemple #1
0
		public void RollingFlatFileTraceListenerNodeDefaults()
		{
			RollingTraceListenerNode rollingListener = new RollingTraceListenerNode();

			Assert.AreEqual("Rolling Flat File Trace Listener", rollingListener.Name);
			Assert.AreEqual(DefaultValues.RollSizeKB, rollingListener.RollSizeKB);
			Assert.AreEqual(DefaultValues.RollingFlatFileTraceListenerFileName, rollingListener.FileName);
			Assert.AreEqual(DefaultValues.RollFileExistsBehaviorValue, rollingListener.RollFileExistsBehavior);
			Assert.AreEqual(DefaultValues.RollIntervalValue, rollingListener.RollInterval);
			Assert.AreEqual(DefaultValues.TimeStampPattern, rollingListener.TimeStampPattern);
			Assert.AreEqual(TraceOptions.None, rollingListener.TraceOutputOptions);
			Assert.AreEqual(DefaultValues.FlatFileListenerHeader, rollingListener.Header);
			Assert.AreEqual(DefaultValues.FlatFileListenerFooter, rollingListener.Footer);
		}
        public void RollingFlatFileTraceListenerNodeDataTest()
        {
            string name             = "some name";
            string fileName         = "some filename";
            string timesTampPattern = "yyyy-MM-dd";
            int    rollSizeKB       = 10;
            RollFileExistsBehavior rollFileExistsBehavior = RollFileExistsBehavior.Increment;
            RollInterval           rollInterval           = RollInterval.Hour;
            TraceOptions           traceOutputOptions     = TraceOptions.Callstack;
            SourceLevels           filter = SourceLevels.Critical;
            string header = "header";
            string footer = "footer";
            RollingFlatFileTraceListenerData rollingFlatFileTraceListenerData = new RollingFlatFileTraceListenerData();

            rollingFlatFileTraceListenerData.Name                   = name;
            rollingFlatFileTraceListenerData.FileName               = fileName;
            rollingFlatFileTraceListenerData.TimeStampPattern       = timesTampPattern;
            rollingFlatFileTraceListenerData.RollSizeKB             = rollSizeKB;
            rollingFlatFileTraceListenerData.RollFileExistsBehavior = rollFileExistsBehavior;
            rollingFlatFileTraceListenerData.RollInterval           = rollInterval;
            rollingFlatFileTraceListenerData.TraceOutputOptions     = traceOutputOptions;
            rollingFlatFileTraceListenerData.Filter                 = filter;
            rollingFlatFileTraceListenerData.Header                 = header;
            rollingFlatFileTraceListenerData.Footer                 = footer;
            RollingTraceListenerNode rollingFlatFileTraceListenerNode = new RollingTraceListenerNode(rollingFlatFileTraceListenerData);

            ApplicationNode.AddNode(rollingFlatFileTraceListenerNode);
            Assert.AreEqual(name, rollingFlatFileTraceListenerNode.Name);
            Assert.AreEqual(fileName, rollingFlatFileTraceListenerNode.FileName);
            Assert.AreEqual(timesTampPattern, rollingFlatFileTraceListenerNode.TimeStampPattern);
            Assert.AreEqual(rollSizeKB, rollingFlatFileTraceListenerNode.RollSizeKB);
            Assert.AreEqual(rollFileExistsBehavior, rollingFlatFileTraceListenerNode.RollFileExistsBehavior);
            Assert.AreEqual(rollInterval, rollingFlatFileTraceListenerNode.RollInterval);
            Assert.AreEqual(traceOutputOptions, rollingFlatFileTraceListenerNode.TraceOutputOptions);
            Assert.AreEqual(filter, rollingFlatFileTraceListenerNode.Filter);
            Assert.AreEqual(header, rollingFlatFileTraceListenerNode.Header);
            Assert.AreEqual(footer, rollingFlatFileTraceListenerNode.Footer);
        }