public void Emit(string expectedOutput, IEnumerable <ResourceDescription> manifestResources, bool emitPdb, bool peVerify, SignatureDescription[] expectedSignatures) { bool doExecute = expectedOutput != null; using (var testEnvironment = new HostedRuntimeEnvironment(dependencies)) { string mainModuleName = Emit(testEnvironment, manifestResources, emitPdb); allModuleData = testEnvironment.GetAllModuleData(); if (peVerify) { testEnvironment.PeVerify(); } if (expectedSignatures != null) { MetadataSignatureUnitTestHelper.VerifyMemberSignatures(testEnvironment, expectedSignatures); } if (doExecute) { testEnvironment.Execute(mainModuleName, expectedOutput); } } }
public void Emit(string expectedOutput, int?expectedReturnCode, string[] args, IEnumerable <ResourceDescription> manifestResources, EmitOptions emitOptions, Verification peVerify, SignatureDescription[] expectedSignatures) { using (var testEnvironment = RuntimeEnvironmentFactory.Create(_dependencies)) { string mainModuleName = Emit(testEnvironment, manifestResources, emitOptions); _allModuleData = testEnvironment.GetAllModuleData(); if (peVerify == Verification.Passes) { testEnvironment.PeVerify(); } else if (peVerify == Verification.Fails) { Assert.Throws <PeVerifyException>(() => testEnvironment.PeVerify()); } if (expectedSignatures != null) { MetadataSignatureUnitTestHelper.VerifyMemberSignatures(testEnvironment, expectedSignatures); } if (expectedOutput != null || expectedReturnCode != null) { var returnCode = testEnvironment.Execute(mainModuleName, args, expectedOutput); if (expectedReturnCode is int exCode) { Assert.Equal(exCode, returnCode); } } } }
public void Emit( string expectedOutput, bool trimOutput, int?expectedReturnCode, string[] args, IEnumerable <ResourceDescription> manifestResources, EmitOptions emitOptions, Verification peVerify, SignatureDescription[] expectedSignatures) { using var testEnvironment = RuntimeEnvironmentFactory.Create(_dependencies); string mainModuleName = Emit(testEnvironment, manifestResources, emitOptions); _allModuleData = testEnvironment.GetAllModuleData(); testEnvironment.Verify(peVerify); #if NETCOREAPP ILVerify(peVerify); #endif if (expectedSignatures != null) { MetadataSignatureUnitTestHelper.VerifyMemberSignatures(testEnvironment, expectedSignatures); } if (expectedOutput != null || expectedReturnCode != null) { var returnCode = testEnvironment.Execute(mainModuleName, args, expectedOutput, trimOutput); if (expectedReturnCode is int exCode) { Assert.Equal(exCode, returnCode); } } }
public void Emit(string expectedOutput, IEnumerable <ResourceDescription> manifestResources, EmitOptions emitOptions, bool peVerify, SignatureDescription[] expectedSignatures) { using (var testEnvironment = RuntimeEnvironmentFactory.Create(_dependencies)) { string mainModuleName = Emit(testEnvironment, manifestResources, emitOptions); _allModuleData = testEnvironment.GetAllModuleData(); if (peVerify) { testEnvironment.PeVerify(); } if (expectedSignatures != null) { MetadataSignatureUnitTestHelper.VerifyMemberSignatures(testEnvironment, expectedSignatures); } if (expectedOutput != null) { testEnvironment.Execute(mainModuleName, expectedOutput); } } }