Answer the question
In order to leave comments, you need to log in
How to test a method that uses an Assembly?
I have developed a method that creates a ResourseManager based on an Assembly. I want to test.
Tried to make a simple mock for Assembly
var expected = new String[] { };
var mock = new Mock<Assembly>();
mock.Setup(a => a.GetManifestResourceNames()).Returns(expected);
var asm = mock.Object;
var rm = new ResourceManager("", asm); // asm isn't runtime assembley
public ResourceManager(String baseName, Assembly assembly)
{
if (null==baseName)
throw new ArgumentNullException("baseName");
if (null==assembly)
throw new ArgumentNullException("assembly");
Contract.EndContractBlock();
if (!(assembly is RuntimeAssembly))
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"));
//....
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question