|
From: Owen R. <OR...@th...> - 2004-12-14 05:09:51
|
i should also point out that you can download the latest build of nmock from ccnetlive. - the project dashboard is here: http://ccnetlive.thoughtworks.com/ccnet/ - and the builds are here: http://ccnetlive.thoughtworks.com/NMock-builds cheers, owen. --- R. Owen Rogers ThoughtWorks Technologies (India) Pvt Ltd. ThoughtWorks - Deliver with passion! ThoughtWorks is always looking for talented people who are passionate about technology. To find out more about a career at ThoughtWorks go to http://www.thoughtworks.com/career/. Jim Arnold <JA...@th...> Sent by: nmo...@li... 08/12/2004 22:06 To: chr...@ho... cc: nmo...@li..., (bcc: Owen Rogers/Canada/ThoughtWorks) Subject: Re: [Nmock-general] ExecutionEngineException with overloaded methods in VB.NET I think VB.Net is a red herring. I think the real problem is the ByRef modifier on IFileCollection::Add. When you tried it with C#, did you add the same (ref) modifier? The ByRef problem has been fixed but not rolled into any release - you just need to download the latest snapshot from CVS on SourceForge. Jim ThoughtWorks -----nmo...@li... wrote: ----- To: nmo...@li... From: "Chris Bartlett" <chr...@ho...> Sent by: nmo...@li... Date: 12/08/2004 03:41PM Subject: [Nmock-general] ExecutionEngineException with overloaded methods in VB.NET When ever I use NMock with overloaded methods in VB.NET I receive an ExecutionEngineException exception. I have created a simple project to demonstrate the problem using a collection. Interfaces: Public Interface IFile ReadOnly Property FileName() As String End Interface Public Interface IFileCollection Inherits IList Overloads Sub Add(ByRef file As IFile) End Interface Factory class: Imports NMock Friend Class Factory Public Shared FileCollectionToReturn As Mock Public Shared FileToReturn As Mock Public Shared Sub Reset() FileCollectionToReturn = Nothing FileToReturn = Nothing End Sub Private Sub New() End Sub Public Shared Function GetFileCollection() As IFileCollection Return CType(FileCollectionToReturn.MockInstance, IFileCollection) End Function Public Shared Function GetFile() As IFile Return CType(FileToReturn.MockInstance, IFile) End Function End Class Class to test: Public Class Sample Public Sub DoStuff() Dim file As IFile = Factory.GetFile() Dim collection As IFileCollection = Factory.GetFileCollection() collection.Add(file) End Sub End Class Test: Imports NMock Imports NUnit.Framework _ Public Class SampleUnitTests _ Public Sub TestDoStuff() Factory.Reset() Dim collection As Mock = New DynamicMock(GetType(IFileCollection)) Factory.FileCollectionToReturn = collection Dim file As Mock = New DynamicMock(GetType(IFile)) Factory.FileToReturn = file collection.Expect("Add", file.MockInstance) Dim sampleClass As Sample = New Sample sampleClass.DoStuff() Collection.Verify() End Sub End Class If I do the same in C# it works as expected. Any help would be very appreciated. Regards, Chris. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Nmock-general mailing list Nmo...@li... https://lists.sourceforge.net/lists/listinfo/nmock-general ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Nmock-general mailing list Nmo...@li... https://lists.sourceforge.net/lists/listinfo/nmock-general |