Unfortunately, due to security and NDA reasons, I cannot give the full
code. What I could do is create a contrived example to illustrate the
issue, but I really don't have time for that right now. I was kind of
hoping this was a known problem. It seems the assembly is getting
modifed by RhinoMocks in such a way as to break the call to:
Assembly assembly = Assembly.GetCallingAssembly()
foreach (String str in
***assembly.GetManifestResourceNames())***
What also bothers me about this is that this code is clearly not a
unit test, it's an integration test, but they're in the same VS
project so they currently run using the same assembly.
cb
On Nov 14, 5:29 am, Tim Barcz <[email protected]> wrote:
> Can you please post a complete sample code (test class and code under test)
> so that we can take a look at the whole.
>
> I'm fairly certain I can help you, I just need a bit more to go on.
>
>
>
> On Fri, Nov 13, 2009 at 7:38 PM, Chuck <[email protected]> wrote:
>
> > First of all, I'm a Java guy, so I'm not familiar with this Dynamic
> > Assembly DLL thing. As such, I apologize in advance.
>
> > I've got a fairly good understanding of Rhino Mocks, but now I have a
> > a config issue I'm not sure how to deal with.
>
> > I'm using NUnit 2.5 and Visual Studio 2008. I've tried using
> > Rhino.Mocks 3.5 and Rhino.Mocks 3.5 for 2.0 as well.
>
> > Whenever I want to do anything interesting with the mocking framework,
> > I seem to be getting these weird error messages in a totally different
> > test.
>
> > Error Message:
>
> > 1) Test Error :
>
> > Unit_Testing.Components.Utilities.TestXmlResourceAccessor.TestGetResourceAsString
> > System.NotSupportedException : The invoked member is not supported
> > in a dynamic assembly.
> > at System.Reflection.Emit.AssemblyBuilder.GetManifestResourceNames
> > ()
> > at xxx.XmlResourceAccessor.GetResourceAsString(String resourceName)
> > in xxx\XmlResourceAccessor.cs:line xx
> > at
>
> > Unit_Testing.Components.Utilities.TestXmlResourceAccessor.TestGetResourceAsString
> > ()
>
> > All are somewhat abbreviated (and obfuscated to protect the innocent)
> > below for things I believe to be irrelevant, but let me know if there
> > is something else you want to see.
>
> > ...The test that causes the failure
> > [TestFixture]
> > public class TestChangePasswordCon
> > {
>
> > [Test]
> > public void TestNewPasswordsMatch()
> > {
> > MockRepository mocks = new MockRepository();
>
> > // Using this code causes error in the other test
> > ChangePasswordCon classUnderTest2 =
> > (ChangePasswordCon)mocks.CreateMock(typeof
> > (ChangePasswordCon));
>
> > ChangePasswordCon classUnderTest = new ChangePasswordCon
> > ();
> > Assert.IsFalse(classUnderTest.NewPasswordsMatch("new",
> > "new"));
>
> > }
> > ...
> > }
>
> > ...The test that shows as the failure(TestXmlResourceAccessor) calls
> > this code: (blows up at the ***)
>
> > public static String GetResourceAsString(String resourceName)
> > {
> > Assembly assembly = Assembly.GetCallingAssembly()
> > foreach (String str in
> > ***assembly.GetManifestResourceNames())***
> > {
> > .......
>
> --
> Tim Barcz
> Microsoft C# MVP
> Microsoft ASPInsiderhttp://timbarcz.devlicio.ushttp://www.twitter.com/timbarcz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rhinomocks?hl=en
-~----------~----~----~----~------~----~------~--~---