It is currently Wed Apr 23, 2014 5:25 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jan 23, 2007 12:37 am 
Offline
Newbie
Newbie

Joined: Mon Jan 22, 2007 1:46 am
Posts: 3
Hi everyone

I have the following code that throws a TypeMockException: Cannot use Return in this sequence, there must be a mocked statement first.

using (RecordExpectations recorder = RecorderManager.StartRecording())
{
File.Exists(null);
recorder.Return(false);
}

The exception occurs on the recorder.Return(false); line. I have tried this with string.IsNullOrEmpty(null); and Directory.Exists(null); and the same result occurs. Am I doing something wrong?

Ide: VS2005
TypeMock version: 3.6.1.0 with fix for FailWhenCalled (See this thread: http://www.typemock.com/community/viewtopic.php?t=402)
NUnit version: .Net 2 2.2.8

Log:
System.IO.File bool Exists(class System.String)
System.Collections.ArrayList instance class System.Collections.IEnumerator GetEnumerator()
System.Collections.ArrayList+ArrayListEnumeratorSimple void .cctor()
System.Collections.ArrayList+ArrayListEnumeratorSimple instance void .ctor(class System.Collections.ArrayList)
System.Collections.ArrayList+ArrayListEnumeratorSimple instance bool MoveNext()
System.Exception instance void .ctor(class System.String)
System.Exception instance void set_HResult(int32)
System.Reflection.TargetInvocationException instance void .ctor(class System.Exception)
System.Environment class System.String GetResourceString(class System.String)
System.Environment class System.String GetResourceStringLocal(class System.String)
System.Environment void InitResourceHelper()
System.Environment+ResourceHelper instance void .ctor()
System.Environment+ResourceHelper instance class System.String GetResourceString(class System.String)
System.Environment+ResourceHelper+GetResourceStringUserData instance void .ctor(class ResourceHelper,class System.String)
System.Environment+ResourceHelper instance void GetResourceStringBackoutCode(class System.Object,bool)
System.Environment+ResourceHelper instance void GetResourceStringCode(class System.Object)
System.Collections.Stack instance void .ctor(int32)
System.Resources.ResourceManager void .cctor()
System.Resources.ResourceReader void .cctor()
System.Collections.Stack instance void Push(class System.Object)
System.Resources.ResourceManager instance void .ctor(class System.String,class System.Reflection.Assembly)
System.Resources.ResourceManager instance void CommonSatelliteAssemblyInit()
System.Resources.ResourceManager instance class System.String GetString(class System.String,class System.Globalization.CultureInfo)
System.Globalization.CultureInfo class System.Globalization.CultureInfo get_CurrentUICulture()
System.Threading.Thread instance class System.Globalization.CultureInfo get_CurrentUICulture()
System.Globalization.CultureInfo class System.Globalization.CultureInfo get_UserDefaultUICulture()
System.Resources.ResourceManager instance class System.Resources.ResourceSet InternalGetResourceSet(class System.Globalization.CultureInfo,bool,bool)
System.Globalization.CultureInfo instance int32 GetHashCode()
System.Globalization.CompareInfo instance int32 GetHashCode()
System.Globalization.CompareInfo instance class System.String get_Name()
System.Resources.ResourceManager instance class System.String GetResourceFileName(class System.Globalization.CultureInfo)
System.Globalization.CultureInfo instance bool Equals(class System.Object)
System.Globalization.CultureInfo bool VerifyCultureName(class System.Globalization.CultureInfo,bool)
System.Resources.ResourceManager class System.Globalization.CultureInfo GetNeutralResourcesLanguage(class System.Reflection.Assembly,value class System.Resources.UltimateResourceFallbackLocation&)
System.Reflection.CustomAttributeData class System.Collections.Generic.IList`1<class System.Reflection.CustomAttributeData> GetCustomAttributes(class System.Reflection.Assembly)
System.Reflection.CustomAttributeData class System.Collections.Generic.IList`1<class System.Reflection.CustomAttributeData> GetCustomAttributes(class System.Reflection.Module,int32)
System.Reflection.CustomAttributeData instance void .ctor(class System.Reflection.Module,value class System.Reflection.CustomAttributeRecord)
System.RuntimeType class System.Reflection.MethodBase GetMethodBase(class System.Reflection.Module,int32)
System.RuntimeType class System.Reflection.MethodBase GetMethodBase(value class System.ModuleHandle,int32)
System.RuntimeType class System.Reflection.MethodBase GetMethodBase(value class System.RuntimeMethodHandle)
System.RuntimeType+RuntimeTypeCache instance class System.Reflection.MethodBase GetConstructor(value class System.RuntimeTypeHandle,value class System.RuntimeMethodHandle)
System.Reflection.CustomAttributeData value class System.Reflection.CustomAttributeType InitCustomAttributeType(class System.Type,class System.Reflection.Module)
System.Reflection.CustomAttributeData value class System.Reflection.CustomAttributeEncoding TypeToCustomAttributeEncoding(class System.Type)
System.Reflection.CustomAttributeType instance void .ctor(value class System.Reflection.CustomAttributeEncoding,value class System.Reflection.CustomAttributeEncoding,value class System.Reflection.CustomAttributeEncoding,class System.String)
System.Reflection.CustomAttributeCtorParameter instance void .ctor(value class System.Reflection.CustomAttributeType)
System.RuntimeType instance class System.Reflection.FieldInfo[] GetFields(value class System.Reflection.BindingFlags)
System.RuntimeType instance class System.Reflection.FieldInfo[] GetFieldCandidates(class System.String,value class System.Reflection.BindingFlags,bool)
System.RuntimeType+RuntimeTypeCache instance class System.Reflection.CerArrayList`1<class System.Reflection.RuntimeFieldInfo> GetFieldList(value class System.Reflection.MemberListType,class System.String)
System.RuntimeType+RuntimeTypeCache+MemberInfoCache`1 instance class System.Collections.Generic.List`1<class System.Reflection.RuntimeFieldInfo> PopulateFields(value class Filter)
System.RuntimeType+RuntimeTypeCache+MemberInfoCache`1 instance void PopulateRtFields(value class Filter,value class System.RuntimeTypeHandle,class System.Collections.Generic.List`1<class System.Reflection.RuntimeFieldInfo>)
System.RuntimeType+RuntimeTypeCache+MemberInfoCache`1 instance void PopulateRtFields(value class Filter,int32**,int32,value class System.RuntimeTypeHandle,class System.Collections.Generic.List`1<class System.Reflection.RuntimeFieldInfo>)
System.RuntimeFieldHandle instance value class System.Utf8String GetUtf8Name()
System.Reflection.RtFieldInfo instance void .ctor(value class System.RuntimeFieldHandle,class System.RuntimeType,class RuntimeTypeCache,value class System.Reflection.BindingFlags)
System.Reflection.RuntimeFieldInfo instance void .ctor(class RuntimeTypeCache,class System.RuntimeType,value class System.Reflection.BindingFlags)
System.Reflection.FieldInfo instance void .ctor()
System.RuntimeType+RuntimeTypeCache+MemberInfoCache`1 instance void PopulateLiteralFields(value class Filter,value class System.RuntimeTypeHandle,class System.Collections.Generic.List`1<class System.Reflection.RuntimeFieldInfo>)
System.Reflection.MetadataImport instance int32 EnumFieldsCount(int32)
System.Reflection.MetadataImport instance void EnumFields(int32,int32*,int32)
System.Reflection.MetadataImport instance value class System.Utf8String GetName(int32)
System.Reflection.MetadataImport instance void GetFieldDefProps(int32,value class System.Reflection.FieldAttributes&)
System.Reflection.RuntimeFieldInfo instance value class System.Reflection.BindingFlags get_BindingFlags()
System.Reflection.RuntimePropertyInfo instance void .ctor(int32,class System.RuntimeType,class RuntimeTypeCache,bool&)
System.Reflection.PropertyInfo instance void .ctor()
System.Reflection.MetadataImport instance void GetPropertyProps(int32,void*&,value class System.Reflection.PropertyAttributes&,value class System.Reflection.ConstArray&)
System.Reflection.MetadataImport instance int32 GetAssociatesCount(int32)
System.Reflection.MetadataImport instance void GetAssociates(int32,value class System.Reflection.AssociateRecord*,int32)
System.Reflection.Associates void AssignAssociates(value class System.Reflection.AssociateRecord*,int32,value class System.RuntimeTypeHandle,value class System.RuntimeTypeHandle,class System.Reflection.RuntimeMethodInfo&,class System.Reflection.RuntimeMethodInfo&,class System.Reflection.RuntimeMethodInfo&,class System.Reflection.RuntimeMethodInfo&,class System.Reflection.RuntimeMethodInfo&,class System.Reflection.MethodInfo[]&,bool&,value class System.Reflection.BindingFlags&)
System.Reflection.Associates class System.Reflection.RuntimeMethodInfo AssignAssociates(int32,value class System.RuntimeTypeHandle,value class System.RuntimeTypeHandle)
System.Reflection.RuntimePropertyInfo instance class System.String get_Name()
System.Utf8String instance class System.String ToString()
System.Text.UTF8Encoding instance int32 GetCharCount(unsigned int8*,int32)
System.Text.UTF8Encoding instance int32 GetCharCount(unsigned int8*,int32,class System.Text.DecoderNLS)
System.Text.UTF8Encoding instance int32 GetChars(unsigned int8*,int32,wchar*,int32)
System.RuntimeTypeHandle instance value class System.RuntimeMethodHandle GetMethodAt(int32)
System.Reflection.RuntimePropertyInfo instance value class System.Reflection.BindingFlags get_BindingFlags()
System.Reflection.RtFieldInfo instance class System.String get_Name()
System.Reflection.RtFieldInfo instance class System.Type get_FieldType()
System.Reflection.RuntimeFieldInfo instance value class System.RuntimeTypeHandle get_DeclaringTypeHandle()
System.Reflection.RuntimeFieldInfo instance class System.Type get_DeclaringType()
System.Signature instance void .ctor(value class System.RuntimeFieldHandle,value class System.RuntimeTypeHandle)
System.Signature instance value class System.RuntimeTypeHandle get_FieldTypeHandle()
System.Reflection.CustomAttributeNamedParameter instance void .ctor(class System.String,value class System.Reflection.CustomAttributeEncoding,value class System.Reflection.CustomAttributeType)
System.Reflection.RuntimePropertyInfo instance class System.Type get_PropertyType()
System.Reflection.RuntimePropertyInfo instance class System.Signature get_Signature()
System.Reflection.RuntimePropertyInfo instance class System.Reflection.Module get_Module()
System.Signature instance void .ctor(void*,int32,value class System.RuntimeTypeHandle)
System.Reflection.CustomAttributeEncodedArgument void ParseAttributeArguments(value class System.Reflection.ConstArray,value class System.Reflection.CustomAttributeCtorParameter[]&,value class System.Reflection.CustomAttributeNamedParameter[]&,class System.Reflection.Module)
System.ComponentModel.Component instance void Finalize()
Sig: 20 00 01
IL_0 = ldarg.0
IL_1 = ldstr 0x7001E052
IL_2 = ldstr 0x7001E54E
IL_3 = ldnull
IL_4 = call 0x0A0008B0
IL_5 = brfalse.s 0x2B
IL_6 = ldarg.0
IL_7 = ldstr 0x7001E052
IL_8 = ldstr 0x7001E54E
IL_9 = ldnull
IL_10 = call 0x0A0008B4
IL_11 = dup
IL_12 = ldstr 0x7001E052
IL_13 = ldstr 0x7001E54E
IL_14 = call 0x0A0008B3
IL_15 = isinst 0x010001FC
IL_16 = brtrue.s 0x02
IL_17 = pop
IL_18 = ret
IL_19 = pop
nop
nop
*INFO: SMALL EH clause TryOffset '0x00000000' HandlerOffset '0x00000009' Flag: 2 Token: 0 Changed to: TryOffset '0x00000040' HandlerOffset: '0x00000049'


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 23, 2007 8:28 am 
Offline
Site Admin
Site Admin

Joined: Thu May 18, 2006 12:03 pm
Posts: 904
Hi Jonathan

The message is misleading in this case.
The problem is that the 'File' class is in mscorlib assembly and sadly we can not mock types in mscorlib. :(
We will try fix message though.

_________________
Regards

Ohad,
TypeMock Support Group


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group