public void TestAddLogWriter() { // GIVEN an empty config builder DarkRiftServerConfigurationBuilder builder = DarkRiftServerConfigurationBuilder.Create(); // WHEN a log writer is added builder.AddLogWriter("name", "type", LogType.Trace); // THEN the log writer is added to the spawn data Assert.AreEqual(1, builder.ServerSpawnData.Logging.LogWriters.Count); Assert.AreEqual("name", builder.ServerSpawnData.Logging.LogWriters[0].Name); Assert.AreEqual("type", builder.ServerSpawnData.Logging.LogWriters[0].Type); Assert.AreEqual(1, builder.ServerSpawnData.Logging.LogWriters[0].LogLevels.Length); Assert.AreEqual(LogType.Trace, builder.ServerSpawnData.Logging.LogWriters[0].LogLevels[0]); Assert.AreEqual(0, builder.ServerSpawnData.Logging.LogWriters[0].Settings.Count); }
public void TestAddLogWriterWithSettings() { // GIVEN an empty config builder DarkRiftServerConfigurationBuilder builder = DarkRiftServerConfigurationBuilder.Create(); // WHEN a log writer is added NameValueCollection settings = new NameValueCollection() { { "key", "value" } }; builder.AddLogWriter("name", "type", settings, LogType.Trace); // THEN the log writer is added to the spawn data Assert.AreEqual(1, builder.ServerSpawnData.Logging.LogWriters.Count); Assert.AreEqual("name", builder.ServerSpawnData.Logging.LogWriters[0].Name); Assert.AreEqual("type", builder.ServerSpawnData.Logging.LogWriters[0].Type); Assert.AreEqual(1, builder.ServerSpawnData.Logging.LogWriters[0].LogLevels.Length); Assert.AreEqual(LogType.Trace, builder.ServerSpawnData.Logging.LogWriters[0].LogLevels[0]); Assert.AreEqual(1, builder.ServerSpawnData.Logging.LogWriters[0].Settings.Count); Assert.AreEqual("value", builder.ServerSpawnData.Logging.LogWriters[0].Settings["key"]); }