Exemplo n.º 1
0
        protected void AssertRunPeVerify(ModuleWeaver weaver)
        {
            Action action = () =>
            {
                var runIlSpy = false;
                try
                {
                    PeVerifier.Verify(Weave.DllPath);
                }
                catch (Exception)
                {
                    runIlSpy = true;
                    throw;
                }
                finally
                {
                    if (runIlSpy || IlSpy.AlwaysRunIlSpy)
                    {
                        var methodName = weaver?.MethodFilters.Single();
                        IlSpy.ShowMethod(methodName, Weave.DllPath);
                        IlSpy.ShowMethod(methodName, Source.DllPath);
                        Thread.Sleep(TimeSpan.FromSeconds(2)); // wait until ILSpy is started because weaved dll will be deleted when unittests exits -> TryCleanupWeavedFiles()
                    }
                }
            };

            action.Should().NotThrow();
        }
        protected void AssertRunPeVerify()
        {
            Action action = () => PeVerifier.Verify(Weave.DllPath);

            action.ShouldNotThrow();
        }
 protected int RunPeVerify()
 {
     return(PeVerifier.Verify(WeaveDll));
 }