public void WhenBothNameAndIDSpecified() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\BasicConfigSourceNameAndId.xml")); StringAssert.Contains(exc.ToString(), "There is an ambiguity when both name and id are specified. Specify only one value."); }
public void OutProcFlatFileEmptyName() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\FlatFile\\FlatFileEmptyName.xml")); StringAssert.Contains(exc.ToString(), "The 'name' attribute is invalid - The value '' is invalid according to its datatype"); }
public void WhenConfigIsValidAndComplete() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\RollingFlatFile\\RollingFlatFile.xml"); Assert.IsNotNull(svcConfiguration); }
public void WhenMaxBufferSizeEmpty() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\AzureTables\\AzureTablesMaxBufferSizeEmpty.xml")); StringAssert.Contains(exc.ToString(), "The 'maxBufferSize' attribute is invalid - The value '' is invalid according to its datatype"); }
public void OutProcFlatFileJsonFormatter() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\FlatFile\\FlatFileJsonFormatter.xml"); Assert.IsNotNull(svcConfiguration); }
public void WhenCustomSinkSchemaHasInvalidPropertyValue() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\ExternalSchemaValidation.xml")); StringAssert.Contains(exc.ToString(), "The 'attr' attribute is invalid - The value 'foo' is invalid according to its datatype"); }
public void WhenMissingInstanceName() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\AzureTables\\AzureTablesMissingInstanceName.xml")); StringAssert.Contains(exc.ToString(), "The required attribute 'instanceName' is missing."); }
public void OutProcRollingFlatFileMissingParams() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\RollingFlatFile\\RollingFlatFileMissingParams.xml"); Assert.IsNotNull(svcConfiguration); }
public void then_exception_is_thrown() { TraceEventServiceConfiguration.Load("Etw\\Configuration\\WithNoEventSourceNameId.xml"); }
public void BasicConfigWrongTypeInFormatterParameterDoesNotThrow() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\WithWrongFormatterParameter.xml", createSinks: false); Assert.IsNotNull(svcConfiguration); }
protected override void When() { this.sut = TraceEventServiceConfiguration.Load("Etw\\Configuration\\WithManyEventSourcesWithArgumentsAndFilters.xml"); }
public void WhenUsingCustomSinkBuiltInSinksForSameSource() { string fileName1 = "multipleFlatFile.log"; File.Delete(fileName1); string fileName2 = "multipleMockFlatFile.log"; File.Delete(fileName2); var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["valid"].ConnectionString; DatabaseHelper.CleanLoggingDB(validConnectionString); var logger = MockEventSourceOutProc.Logger; string message = string.Concat("Message ", Guid.NewGuid()); string message2 = string.Concat("Message2 ", Guid.NewGuid()); IEnumerable <string> entries = null; IEnumerable <string> entries2 = null; var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\CustomSink\\Multiple.xml"); using (TraceEventService collector = new TraceEventService(svcConfiguration)) { try { collector.Start(); logger.LogSomeMessage(message); logger.LogSomeMessage(message2); entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName1, 2, "--==--"); entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName2, 2, "==-=="); DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 4); } finally { collector.Stop(); } } Assert.IsTrue(File.Exists(fileName1)); Assert.AreEqual <int>(2, entries.Count()); StringAssert.Contains(entries.First().ToString(), message); StringAssert.Contains(entries.Last().ToString(), message2); Assert.IsTrue(File.Exists(fileName2)); Assert.AreEqual <int>(2, entries.Count()); StringAssert.Contains(entries.First().ToString(), message); StringAssert.Contains(entries.Last().ToString(), message2); var dt = DatabaseHelper.GetLoggedTable(validConnectionString); Assert.AreEqual(4, dt.Rows.Count); var rowsWithMessage1 = dt.Select(string.Format("Payload like '%{0}%'", message)); Assert.AreEqual(2, rowsWithMessage1.Count()); var dr = rowsWithMessage1[0]; Assert.AreEqual(4, (int)dr["Level"]); Assert.AreEqual(8, (int)dr["EventID"]); Assert.AreEqual("testingInstance", dr["InstanceName"].ToString()); StringAssert.Contains((string)dr["Payload"], message); dr = rowsWithMessage1[1]; Assert.AreEqual(4, (int)dr["Level"]); Assert.AreEqual(8, (int)dr["EventID"]); Assert.AreEqual("testingInstance", dr["InstanceName"].ToString()); StringAssert.Contains((string)dr["Payload"], message); var rowsWithMessage2 = dt.Select(string.Format("Payload like '%{0}%'", message2)); Assert.AreEqual(2, rowsWithMessage2.Count()); dr = rowsWithMessage2[0]; Assert.AreEqual(4, (int)dr["Level"]); Assert.AreEqual(8, (int)dr["EventID"]); Assert.AreEqual("testingInstance", dr["InstanceName"].ToString()); StringAssert.Contains((string)dr["Payload"], message2); dr = rowsWithMessage2[1]; Assert.AreEqual(4, (int)dr["Level"]); Assert.AreEqual(8, (int)dr["EventID"]); Assert.AreEqual("testingInstance", dr["InstanceName"].ToString()); StringAssert.Contains((string)dr["Payload"], message2); }
public void WhenOnlyMandatoryProperties() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\RollingFlatFile\\RollingFlatFileMissingParams.xml"); Assert.IsNotNull(svcConfiguration); }
public void WhenNoFormatterSpecified() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\RollingFlatFile\\RollingFlatFileNoFormatter.xml"); Assert.IsNotNull(svcConfiguration); }
public void WhenSessionPrefixIsEmpty() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\ConfigSessionNameEmpty.xml")); StringAssert.Contains(exc.ToString(), "The 'sessionNamePrefix' attribute is invalid - The value '' is invalid according to its datatype "); }
protected override void When() { this.sut = TraceEventServiceConfiguration.Load("Etw\\Configuration\\WithManySinks.xml"); }
public void WhenSourceNameIsEmpty() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\NoEventSourceName.xml")); StringAssert.Contains(exc.ToString(), "The EventSource 'name' and 'id' values are missing. Please provide either name or id."); }
public void then_exception_is_thrown() { var sut = TraceEventServiceConfiguration.Load("Etw\\Configuration\\WithBadTypes.xml"); }
public void WhenWrongTypeForFormatter() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\WithWrongFormatterParameter.xml", createSinks: false); Assert.IsNotNull(svcConfiguration); }
protected override void When() { this.sut = TraceEventServiceConfiguration.Load("Etw\\Configuration\\WithExtensionsNoSchemaValidation.xml"); }
public void WhenMissingTableAddress() { var serviceConfiguration = TraceEventServiceConfiguration.Load("Configurations\\AzureTables\\AzureTablesMissingTableAddress.xml"); Assert.IsNotNull(serviceConfiguration); }
protected override void When() { this.sut = TraceEventServiceConfiguration.Load("Etw\\Configuration\\WithDefaultValues.xml"); }
public void WhenConfigValidAndComplete() { var serviceConfiguration = TraceEventServiceConfiguration.Load("Configurations\\AzureTables\\AzureTablesMaxBufferSize.xml"); Assert.IsNotNull(serviceConfiguration); }
protected override void When() { this.sut = TraceEventServiceConfiguration.Load("Etw\\Configuration\\WithEventSourceIdOnly.xml"); }
public void OutProcFlatFileXmlFormatterMissingParams() { var svcConfiguration = TraceEventServiceConfiguration.Load("Configurations\\FlatFile\\FlatFileXmlFormatterMissingParams.xml"); Assert.IsNotNull(svcConfiguration); }
public void AzureTablesEmptyTableAddress() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\AzureTables\\AzureTablesEmptyTableAddress.xml")); StringAssert.Contains(exc.ToString(), "The 'tableAddress' attribute is invalid - The value '' is invalid according to its datatype"); }
public void WhenUsingCustomSinkWithSchemaAndNotAllParametersProvided() { var exc = ExceptionAssertHelper.Throws <Exception>(() => TraceEventServiceConfiguration.Load("Configurations\\CustomSink\\CustomSinkMissingParam.xml")); StringAssert.Contains(exc.ToString(), "The parameters specified in this element does not map to an existing type member. All paramters are required in the same order of the defined type member"); }
public void WhenUsingXmlFormatterWithInvalidDateTimeFormate() { var exc = ExceptionAssertHelper.Throws <ConfigurationException>(() => TraceEventServiceConfiguration.Load("Configurations\\WithFormatter\\FlatFileXmlWrongDateTime.xml")); StringAssert.Contains(exc.InnerException.Message, "The date time format is invalid."); }