You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error occurs on the execution of the first line:
Smock.Run(async context =>
You Say
Strong-named assemblies
To intercept calls to targeted methods and properties, Smocks rewrites assemblies and subsequently loads the modified copies. Should the original assembly be strong-named, the assembly will need to be signed again after modification to restore the strong-naming. Smocks currently does not support rewriting strong-named assemblies.
Assumption
This is the first time I have used SMocks and I am assuming that the above is from Microsoft strongly named assemblies.
The text was updated successfully, but these errors were encountered:
Seeing the same Issue. using .net core 3.1 I believe that Smocks is not fully compatible with .net core because the nugget package error indicates that it's targeting .net framework 4.7. Can you confirm that this is the issue.
code:
Smock.Run(async context =>
{
Mock<ILogger<PropertySetRepository>> loggerMock = new Mock<ILogger<PropertySetRepository>>();
Mock<ISqlServerDatabase> sqlServerDatabaseMock = new Mock<ISqlServerDatabase>();
PropertySetRepository prop = new PropertySetRepository(sqlServerDatabaseMock.Object, loggerMock.Object);
var storedProc = "[dbo].[GetAuditHistoryApprovalsByPropertySetId]";
IStoredProcedure procedure = new InlineStoredProcedure(storedProc)
{
{ "PropertySetId", 1234 }
};
IReadOnlyList<ApprovalModel> approvals = new List<ApprovalModel>();
context.Setup(() => sqlServerDatabaseMock.Object.ExtractAsync(procedure, new ApprovalExtractor(), CancellationToken.None)).Returns(Task.FromResult(approvals));
//sqlServerDatabaseMock.Setup(t => t.ExtractAsync(procedure, new ApprovalExtractor(), CancellationToken.None));
var res = prop.GetCompSetAuditHistoryApprovals(1234);
});
stack trace:
at Smocks.AppDomains.AppDomainContext..ctor(IAssemblyLoaderFactory assemblyLoaderFactory, ISerializer serializer, Logger logger, ISerializableLambdaFilter[] lambdaFilters)
at Smocks.AppDomains.AppDomainContext..ctor(IAssemblyRewriter assemblyRewriter, Logger logger)
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)
at PropertySetData.Tests.Repositories.PropertySetRepositoryTest.a() in C:\Users\cjohnson2\source\repos\services-external-hospitality-property-set-api\Source\tests\PropertySetData.Tests\Repositories\PropertySetRepository.cs:line 25
Test Code
Error Message
Message:
System.MissingMethodException : Method not found: 'Void System.AppDomainSetup.set_ApplicationBase(System.String)'.
Stack Trace:
AppDomainContext.ctor(IAssemblyLoaderFactory assemblyLoaderFactory, ISerializer serializer, Logger logger, ISerializableLambdaFilter[] lambdaFilters)
AppDomainContext.ctor(IAssemblyRewriter assemblyRewriter, Logger logger)
Smock.RunAction(Action
1 action, Configuration configuration) Smock.Run(Configuration configuration, Action
1 action)Smock.Run(Action
1 action) EmailConfirmation_UnitTests.EmailConfirmation_Page_Test() line 59 GenericAdapter
1.GetResult()AsyncToSyncAdapter.Await(Func`1 invoke)
TestMethodCommand.RunTestMethod(TestExecutionContext context)
TestMethodCommand.Execute(TestExecutionContext context)
<>c__DisplayClass1_0.b__0()
BeforeAndAfterTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
Error Occurs
The error occurs on the execution of the first line:
You Say
Strong-named assemblies
To intercept calls to targeted methods and properties, Smocks rewrites assemblies and subsequently loads the modified copies. Should the original assembly be strong-named, the assembly will need to be signed again after modification to restore the strong-naming. Smocks currently does not support rewriting strong-named assemblies.
Assumption
This is the first time I have used SMocks and I am assuming that the above is from Microsoft strongly named assemblies.
The text was updated successfully, but these errors were encountered: