public void TypeWithNoEventLogsReturnsUnchangedInstaller() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(NoLogsType) }); builder.Fill(parentInstaller); Assert.AreEqual(0, parentInstaller.Installers.Count); }
public void WillFindSingleEventLogTypeInListOfTypes() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(NoLogsType), typeof(SimpleLogType) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(EventLogInstaller), parentInstaller.Installers[0].GetType()); EventLogInstaller installer = (EventLogInstaller)parentInstaller.Installers[0]; Assert.AreEqual("FooLog", installer.Log); }
public void OptionalAttributesCanBeSet() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(ComplexLogType) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(EventLogInstaller), parentInstaller.Installers[0].GetType()); EventLogInstaller installer = (EventLogInstaller)parentInstaller.Installers[0]; Assert.AreEqual("BarLog", installer.Log); Assert.AreEqual("BarSource", installer.Source); Assert.AreEqual(7, installer.CategoryCount); Assert.AreEqual("Bar.resources", installer.CategoryResourceFile); Assert.AreEqual("BarMessages.resources", installer.MessageResourceFile); Assert.AreEqual("BarResources.resources", installer.ParameterResourceFile); }
public void LogIsAddedToInstaller() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(SimpleLogType) }); builder.Fill(parentInstaller); Assert.AreEqual(1, parentInstaller.Installers.Count); Assert.AreSame(typeof(EventLogInstaller), parentInstaller.Installers[0].GetType()); EventLogInstaller installer = (EventLogInstaller)parentInstaller.Installers[0]; Assert.AreEqual("FooLog", installer.Log); Assert.AreEqual("FooSource", installer.Source); Assert.AreEqual(0, installer.CategoryCount); Assert.IsNull(installer.CategoryResourceFile); Assert.IsNull(installer.MessageResourceFile); Assert.IsNull(installer.ParameterResourceFile); }
public void SameSourceManyTimesCreatesMultipleInstallers() { Installer parentInstaller = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder( new Type[] { typeof(SimpleLogType), typeof(SimpleLogTypeSameSource) }); builder.Fill(parentInstaller); Assert.AreEqual(2, parentInstaller.Installers.Count); Assert.AreSame(typeof(EventLogInstaller), parentInstaller.Installers[0].GetType()); EventLogInstaller installer1 = (EventLogInstaller)parentInstaller.Installers[0]; EventLogInstaller installer2 = (EventLogInstaller)parentInstaller.Installers[1]; Assert.AreEqual("FooLog", installer1.Log); Assert.AreEqual("FooSource", installer1.Source); Assert.AreEqual("FooLog2", installer2.Log); Assert.AreEqual("FooSource", installer2.Source); }
public void NoExceptionThrownIfNoInstrumentedType() { Installer installer = new Installer(); EventLogInstallerBuilder builder = new EventLogInstallerBuilder(new Type[] { typeof(NoLogsType) }); builder.Fill(installer); }