Skip to content

[no-merge] Add unit tests for Issue389#392

Closed
ericnewton76 wants to merge 1 commit intodevelopfrom
fix/issue-389
Closed

[no-merge] Add unit tests for Issue389#392
ericnewton76 wants to merge 1 commit intodevelopfrom
fix/issue-389

Conversation

@ericnewton76
Copy link
Copy Markdown
Member

@ericnewton76 ericnewton76 commented Jan 18, 2019

This tries to address #389

Note, this PR may never get merged.

@ericnewton76 ericnewton76 changed the base branch from master to develop January 18, 2019 04:19
@ericnewton76 ericnewton76 changed the title Fix for issue 389 [no-merge] Add unit tests for Issue389 Jan 23, 2019
@moh-hassan
Copy link
Copy Markdown
Collaborator

moh-hassan commented Mar 13, 2019

The resolve this issue , the test class should reference the next class:

	 public class BaseTest
		{
			public BaseTest()  
			{  
				//in case multi target project,use #if because no appdomain in netcore
	#if NETFRAMEWORK
			  
				var assembly = Assembly.GetCallingAssembly();  

				var manager = new AppDomainManager();  
				var entryAssemblyfield = manager.GetType().GetField("m_entryAssembly", BindingFlags.Instance | BindingFlags.NonPublic);  
				entryAssemblyfield?.SetValue(manager, assembly); 

				var domain = AppDomain.CurrentDomain;  
				var domainManagerField = domain.GetType().GetField("_domainManager", BindingFlags.Instance | BindingFlags.NonPublic);  
				domainManagerField?.SetValue(domain, manager);  
				
	#endif
			} 
		}

Then test class inherit BaseTest:

      public class Issue389_Tests: BaseTest
   {
      //test stuff
      }

The solution is tested for the same issue#389 here

@moh-hassan
Copy link
Copy Markdown
Collaborator

The test case is involved and Pass in PR 389 in both net461 and netcoreapp2.0 after resolving the null EntryAssemply problems

@moh-hassan
Copy link
Copy Markdown
Collaborator

@ericnewton76
It's added and merged to PR #430

@moh-hassan moh-hassan closed this Apr 27, 2019
@moh-hassan moh-hassan mentioned this pull request Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants