Esempio n. 1
0
        public void CreateFromInstallerExceptionForRecord()
        {
            // Construct an InstallerException from Windows Installer record data.
            var iex = new InstallerException();
            var data = new object[] { 1715, "TEST" };
            iex.GetType().GetField("errorData", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(iex, data);

            using (var psiex = new PSInstallerException(iex))
            {
                var error= psiex.ErrorRecord;

                Assert.IsNotNull(error);
                Assert.AreEqual("Installed TEST", psiex.Message, true);
                Assert.AreEqual("TEST", error.TargetObject as string, true);
            }
        }