We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am getting this error when trying to setup a callback for a static method that has two int? arguments with default values of null.
My static method looks like this:
public List<EventTriggerAction> LookupActions(int? fieldValueChangedID = null, int? eventTriggerActionID = null) { using (var conn = new SqlConnection(ConnectionString.Sql)) { using (var cmd = new SqlCommand("EventTriggerActionGroup_LookupActions", conn)) { // DB call } } }
My test:
Smock.Run(context => { EventTriggerActionGroup group = EventTriggerActionGroupTests.Mock(); context.Setup(() => group.LookupActions(null, null)).Returns(mockLookUpActions); scheduleSet.ExecuteAllEventTriggerActionGroups(); // Method that depends on LookupActions() Assert.IsNull(scheduleSet); });
Stacktrace:
System.NotImplementedException: Unexpected opcode: Initobj at Smocks.IL.Visitors.NumberPoppedVisitor.Visit(Instruction instruction) at Smocks.IL.Visitors.InstructionVisitorBase`1.VisitType(Instruction instruction, TypeReference typeReference) at Smocks.IL.Visitors.InstructionVisitorBase`1.VisitInlineType(Instruction instruction, TypeReference operand) at Smocks.IL.InstructionExtensions.Accept[T](Instruction instruction, IInstructionVisitor`1 visitor) at Smocks.IL.ExpressionDecompiler`1.GetNumberPoppedByInstruction(Instruction current) at Smocks.IL.ExpressionDecompiler`1.IncludeInstructionsUntilStackEmpty(MethodBody body, Instruction instruction, BitArray includedInstructions, Int32 expectedStackSize) at Smocks.IL.ExpressionDecompiler`1.Decompile(MethodBody body, Instruction instruction, Object target, Int32 expectedStackSize, Int32 stackEntriesToSkip) at Smocks.IL.ExpressionDecompiler`1.Decompile(MethodBody body, Instruction instruction, Object target) at Smocks.IL.SetupExtractor.<GetSetupsFromInstructions>d__10.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Smocks.Smock.CreateAssemblyRewriter(Delegate delegate, Configuration configuration) at Smocks.Smock.RunAction(Action`1 action, Configuration configuration) at Smocks.Smock.Run(Configuration configuration, Action`1 action) at Smocks.Smock.Run(Action`1 action)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am getting this error when trying to setup a callback for a static method that has two int? arguments with default values of null.
My static method looks like this:
My test:
Stacktrace:
The text was updated successfully, but these errors were encountered: