Pleassssssse help. Structure map and NServicebus issue

33 views
Skip to first unread message

cssssssssssssssssss

unread,
Aug 3, 2019, 2:28:38 AM8/3/19
to structuremap-users
We have an MVC appwhuch woks perfectly.  Yet , when we put the same code  IN OUR NUNIT tests UNDER [OneTimeSetup ]in a base class for tests,  Each test works only if we run each test independently    But highlight two or more tests - and the first one will succeed, any other test will fill with the following.


Please have mercy.  Any thoughts would be appreciated.

Charles


Test Name: CancelAppointmentDoNotReschedule
Test FullName: AA.Scheduling.Core.Tests.AppointmentTests.CancelAppointmentDoNotReschedule
Test Source: C:\Projects\schedulingapi\src\AA.Scheduling..Core.Tests\AppointmentTests.cs : line 726
Test Outcome: Failed
Test Duration: 0:00:07.681

Result StackTrace:
at lambda_method(Closure , IBuildSession , IContext )
   at StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext context) in C:\BuildAgent\work\a395dbde6b793293\src\StructureMap.Shared\Building\BuildPlan.cs:line 152
   at StructureMap.Pipeline.LifecycleObjectCache.Get(Type pluginType, Instance instance, IBuildSession session) in C:\BuildAgent\work\a395dbde6b793293\src\StructureMap.Shared\Pipeline\LifecycleObjectCache.cs:line 75
   at StructureMap.SessionCache.GetObject(Type pluginType, Instance instance, ILifecycle lifecycle) in C:\BuildAgent\work\a395dbde6b793293\src\StructureMap.Shared\SessionCache.cs:line 93
   at StructureMap.SessionCache.GetDefault(Type pluginType, IPipelineGraph pipelineGraph) in C:\BuildAgent\work\a395dbde6b793293\src\StructureMap.Shared\SessionCache.cs:line 68
   at MediatR.ServiceFactoryExtensions.GetInstances[T](ServiceFactory factory)
   at MediatR.Internal.NotificationHandlerWrapperImpl`1.Handle(INotification notification, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`2 publish)
   at MediatR.Mediator.PublishNotification(INotification notification, CancellationToken cancellationToken)
   at MediatR.Mediator.Publish[TNotification](TNotification notification, CancellationToken cancellationToken)
   at AA.Scheduling.Core.Handlers.CommandHandlers.CreateNewAppointmentCommandHandler.<CreateAppointment>d__7.MoveNext() in C:\Projects\schedulingapi\src\AA.Scheduling.Core\Handlers\CommandHandlers\CreateNewAppointmentCommandHandler.cs:line 350
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at AA.Scheduling.Core.Handlers.CommandHandlers.CreateNewAppointmentCommandHandler.<Handle>d__4.MoveNext() in C:\Projects\schedulingapi\src\AA.Scheduling.Core\Handlers\CommandHandlers\CreateNewAppointmentCommandHandler.cs:line 212
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at AA.Scheduling.Core.Tests.UnitOfWork`2.<Handle>d__3.MoveNext() in C:\Projects\schedulingapi\src\AA.Scheduling..Core.Tests\UnitOfWork.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at AA.Scheduling.Core.Tests.AppointmentTests.<CreateNewAppointment>d__18.MoveNext() in C:\Projects\schedulingapi\src\AA.Scheduling..Core.Tests\AppointmentTests.cs:line 951
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at AA.Scheduling.Core.Tests.AppointmentTests.<CancelAppointmentDoNotReschedule>d__14.MoveNext() in C:\Projects\schedulingapi\src\AA.Scheduling..Core.Tests\AppointmentTests.cs:line 739
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at NUnit.Framework.Internal.AsyncInvocationRegion.AsyncTaskInvocationRegion.WaitForPendingOperationsToComplete(Object invocationResult)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunAsyncTestMethod(TestExecutionContext context)
--ConfigurationErrorsException
   at NServiceBus.Settings.SettingsHolder.EnsureWriteEnabled(String key) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 296
   at NServiceBus.Settings.SettingsHolder.SetDefault(String key, Object value) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 254
   at NServiceBus.EndpointConfiguration.Build() in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\EndpointConfiguration.cs:line 202
   at NServiceBus.Endpoint.Create(EndpointConfiguration configuration) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Endpoint.cs:line 16
   at NServiceBus.Endpoint.<Start>d__1.MoveNext() in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Endpoint.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at lambda_method(Closure , IBuildSession , IContext )
Result Message:
StructureMap.Building.StructureMapBuildException : Failure while building 'Lambda: Start(value(AA.Scheduling.Core.Tests.TestBase+<>c__DisplayClass6_0).endpointConfiguration).GetAwaiter().GetResult()', check the inner exception for details
1.) Lambda: Start(value(AA.Scheduling.Core.Tests.TestBase+<>c__DisplayClass6_0).endpointConfiguration).GetAwaiter().GetResult()
2.) Instance of NServiceBus.IMessageSession (NServiceBus.IEndpointInstance)
3.) new PublishNServiceBusEventOnAppointmentCreatedEventHandler(*Default of IMessageSession*, *Default of ILog*, *Default of ISession*)
4.) AA.Scheduling.Core.Handlers.EventHandlers.PublishNServiceBusEventOnAppointmentCreatedEventHandler
5.) Instance of INotificationHandler<AppointmentCreatedDomainEvent> (AA.Scheduling.Core.Handlers.EventHandlers.PublishNServiceBusEventOnAppointmentCreatedEventHandler)
6.) All registered children for IEnumerable<INotificationHandler<AppointmentCreatedDomainEvent>>
7.) Instance of IEnumerable<INotificationHandler<AppointmentCreatedDomainEvent>>

  ----> System.Configuration.ConfigurationErrorsException : Unable to set the value for key: TypesToScan. The settings has been locked for modifications. Move any configuration code earlier in the configuration pipeline

Reply all
Reply to author
Forward
0 new messages