Example #1
0
    public static void Enable(bool captureLogs = true)
    {
        if (captureLogs)
        {
            LogCapture.Initialize();
        }

        VerifierSettings.IgnoreMember <TestableMessageProcessingContext>(x => x.MessageHeaders);
        VerifierSettings.IgnoreMember <TestableInvokeHandlerContext>(x => x.Headers);
        VerifierSettings.IgnoreMember <TestableMessageProcessingContext>(x => x.MessageId);
        VerifierSettings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageHandler);
        VerifierSettings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageBeingHandled);
        VerifierSettings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageMetadata);
        VerifierSettings.IgnoreMember <IMessageProcessingContext>(x => x.ReplyToAddress);
        VerifierSettings.IgnoreMember <TestableEndpointInstance>(x => x.EndpointStopped);
        VerifierSettings.IgnoreMember <TestableOutgoingLogicalMessageContext>(x => x.RoutingStrategies);
        VerifierSettings.IgnoreMember <TestableOutgoingPhysicalMessageContext>(x => x.RoutingStrategies);
        VerifierSettings.IgnoreMember <TestableRoutingContext>(x => x.RoutingStrategies);
        VerifierSettings.IgnoreInstance <ContextBag>(x => !ContextBagHelper.HasContent(x));
        VerifierSettings.AddExtraSettings(serializerSettings =>
        {
            var converters = serializerSettings.Converters;
            converters.Add(new ContextBagConverter());
            converters.Add(new SendOptionsConverter());
            converters.Add(new ExtendableOptionsConverter());
            converters.Add(new UnsubscriptionConverter());
            converters.Add(new TimeoutMessageConverter());
            converters.Add(new MessageToHandlerMapConverter());
            converters.Add(new SubscriptionConverter());
            converters.Add(new OutgoingMessageConverter());
        });
    }
Example #2
0
    void Converter()
    {
        #region JsonConverter

        VerifierSettings.AddExtraSettings(_ => { _.Converters.Add(new CompanyConverter()); });

        #endregion
    }
Example #3
0
 public static void Enable() =>
 VerifierSettings
 .AddExtraSettings(_ =>
 {
     var converters = _.Converters;
     converters.Add(new SessionConverter());
     converters.Add(new LazyStringValueConverter());
 });
Example #4
0
        public MessageConverterTests()
        {
            DiffTools.UseOrder(DiffTool.VisualStudioCode, DiffTool.Rider, DiffTool.VisualStudio);
            VerifierSettings.AddExtraSettings(s => s.Converters.Add(new EncodingConverter()));

            settings = new VerifySettings();
            settings.ModifySerialization(_ =>
            {
                _.IgnoreMembersWithType <Stream>();
            });
        }
Example #5
0
    public static void Initialize()
    {
        VerifyNServiceBus.Enable();
        var nsbVersion       = FileVersionInfo.GetVersionInfo(typeof(Endpoint).Assembly.Location);
        var nsbVersionString = $"{nsbVersion.FileMajorPart}.{nsbVersion.FileMinorPart}.{nsbVersion.FileBuildPart}";

        VerifierSettings.IgnoreStackTrace();
        VerifierSettings.AddScrubber(x => x.Replace(nsbVersionString, "NsbVersion"));
        VerifierSettings.ScrubMachineName();
        VerifierSettings.AddExtraSettings(_ =>
        {
            _.Converters.Add(new LogEventPropertyConverter());
            _.Converters.Add(new LogEventConverter());
            _.Converters.Add(new ScalarValueConverter());
            _.Converters.Add(new PropertyEnricherConverter());
        });
        VerifierSettings.AddExtraDatetimeOffsetFormat("yyyy-MM-dd HH:mm:ss:ffffff Z");
    }
Example #6
0
    void ApplyExtraSettingsSample()
    {
        #region ExtraSettingsGlobal

        VerifierSettings.AddExtraSettings(_ =>
        {
            _.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
            _.TypeNameHandling   = TypeNameHandling.All;
        });

        #endregion

        #region ExtraSettingsInstance

        VerifySettings settings = new();
        settings.AddExtraSettings(_ =>
        {
            _.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
            _.TypeNameHandling   = TypeNameHandling.All;
        });

        #endregion
    }