Beispiel #1
0
 public static void Enable(bool captureLogs = true)
 {
     if (captureLogs)
     {
         LogCapture.Initialize();
     }
     VerifierSettings.ModifySerialization(settings =>
     {
         settings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageHeaders);
         settings.IgnoreMember <TestableInvokeHandlerContext>(x => x.Headers);
         settings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageId);
         settings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageHandler);
         settings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageBeingHandled);
         settings.IgnoreMember <TestableInvokeHandlerContext>(x => x.MessageMetadata);
         settings.IgnoreMember <IMessageProcessingContext>(x => x.ReplyToAddress);
         settings.IgnoreMember <TestableEndpointInstance>(x => x.EndpointStopped);
         settings.IgnoreMember <TestableOutgoingLogicalMessageContext>(x => x.RoutingStrategies);
         settings.IgnoreMember <TestableOutgoingPhysicalMessageContext>(x => x.RoutingStrategies);
         settings.IgnoreMember <TestableRoutingContext>(x => x.RoutingStrategies);
         settings.IgnoreInstance <ContextBag>(x => !ContextBagHelper.HasContent(x));
         settings.IgnoreMembersWithType <IBuilder>();
         settings.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());
         });
     });
 }
Beispiel #2
0
    public static void Init()
    {
        VerifierSettings.ModifySerialization(
            settings =>
        {
            settings.AddExtraSettings(x =>
            {
                x.Converters.Add(new ResultConverter());
                x.Converters.Add(new TimestampConverter());
            });
#if NET5_0
            settings.IgnoreMember <System.Net.Http.HttpRequestException>(x => x.StatusCode);
#endif
            settings.IgnoreMember <Result>(x => x.File);
            settings.IgnoreMembers(
                "StackTrace",
                "Content-Length",
                "TrailingHeaders",
                "X-Amzn-Trace-Id",
                "Set-Cookie",
                "Report-To",
                "Connection",
                "Server-Timing",
                "Content-Type",
                "NEL",
                "Accept-Ranges",
                "Age",
                "Server",
                "X-Client-IP",
                "Strict-Transport-Security",
                "X-Cache-Status",
                "X-Cache",
                "origin");
        });
    }
Beispiel #3
0
 static Tests()
 {
     VerifyDiffPlex.Initialize();
     VerifierSettings.DisableClipboard();
     VerifierSettings.ModifySerialization(
         settings => settings.IgnoreMember <Exception>(_ => _.StackTrace));
 }
    void DontIgnoreEmptyCollections()
    {
        #region DontIgnoreEmptyCollections

        VerifierSettings.ModifySerialization(_ => _.DontIgnoreEmptyCollections());

        #endregion
    }
    void DontIgnoreFalse()
    {
        #region DontIgnoreFalse

        VerifierSettings.ModifySerialization(_ => _.DontIgnoreFalse());

        #endregion
    }
 public static void Setup()
 {
     VerifierSettings.ModifySerialization(settings =>
     {
         settings.IgnoreMembersThatThrow(x => x.Message == "Cannot escape out of a Tree.");
         settings.IgnoreMember <Parts>(x => x.Sha);
     });
 }
    void DontScrubDateTimes()
    {
        #region DontScrubDateTimes

        VerifierSettings.ModifySerialization(_ => _.DontScrubDateTimes());

        #endregion
    }
Beispiel #8
0
 public static void Enable() =>
 VerifierSettings.ModifySerialization(settings =>
 {
     settings.AddExtraSettings(serializerSettings =>
     {
         var converters = serializerSettings.Converters;
         converters.Add(new SessionConverter());
         converters.Add(new LazyStringValueConverter());
     });
 });
Beispiel #9
0
 public Task NumericIdScrubbingDisabledGlobal()
 {
     VerifierSettings.ModifySerialization(settings => settings.DontScrubNumericIds());
     return(Verifier.Verify(
                new
     {
         Id = 5,
         OtherId = 5,
         YetAnotherId = 4
     }));
 }
 public Task NumericIdScrubbingDisabledGlobal()
 {
     VerifierSettings.ModifySerialization(settings => settings.DontScrubNumericIds());
     return(Verifier.Verify(
                new
     {
         Id = 5,
         OtherId = 5,
         YetAnotherId = 4,
         PossibleNullId = (int?)5,
         ActualNullId = (int?)null
     }));
 }
Beispiel #11
0
 public static void Initialize()
 {
     VerifierSettings.ModifySerialization(settings =>
     {
         settings.AddExtraSettings(serializerSettings =>
         {
             var converters = serializerSettings.Converters;
             converters.Add(new ProcessResultConverter());
             converters.Add(new SnippetConverter());
         });
     });
     VerifierSettings.AddScrubber(Scrubber.Scrub);
 }
 public static void Initialize()
 {
     VerifierSettings.ModifySerialization(settings =>
     {
         settings.AddExtraSettings(serializerSettings =>
         {
             var converters = serializerSettings.Converters;
             converters.Add(new ProcessResultConverter());
             converters.Add(new SnippetConverter());
         });
         settings.IgnoreMember <Exception>(exception => exception.StackTrace);
     });
 }
    public static void Initialize()
    {
        VerifySqlServer.Enable();
        VerifierSettings.ModifySerialization(settings =>
        {
            settings.AddExtraSettings(serializerSettings =>
                                      serializerSettings.TypeNameHandling = TypeNameHandling.Objects);
        });
        SqlHelper.EnsureDatabaseExists(Connection.ConnectionString);
        using var sqlConnection = Connection.OpenConnection();
        var manager = new QueueManager("error", sqlConnection);

        manager.Create().Await();
    }
 public static void Initialize()
 {
     VerifierSettings.AddScrubber(x => x.RemoveLineSuffix("boundary="));
     VerifierSettings.ModifySerialization(settings =>
     {
         settings.IgnoreMember <ExecutionResult>(result => result.Perf);
         settings.IgnoreMember <ExecutionResult>(result => result.Document);
         settings.IgnoreMember <ExecutionResult>(result => result.Operation);
         settings.AddExtraSettings(serializerSettings =>
         {
             serializerSettings.Converters.Add(new AttachmentConverter());
             serializerSettings.Converters.Add(new QueryResultConverter());
         });
     });
 }
 public static void Initialize()
 {
     VerifierSettings.ModifySerialization(settings =>
     {
         settings.IgnoreMember <ExecutionResult>(result => result.Perf);
         settings.IgnoreMember <ExecutionResult>(result => result.Document);
         settings.IgnoreMember <ExecutionResult>(result => result.Operation);
         settings.AddExtraSettings(serializerSettings =>
         {
             serializerSettings.Converters.Add(new OutgoingConverter());
             serializerSettings.Converters.Add(new AttachmentStreamConverter());
             serializerSettings.Converters.Add(new OutgoingAttachmentsConverter());
         });
     });
 }
    public static void Initialize()
    {
        VerifyImageMagick.RegisterComparers(.01);

        VerifierSettings.ModifySerialization(settings =>
        {
            settings.IgnoreMembers(
                "traceparent",
                "Traceparent",
                "X-Amzn-Trace-Id",
                "origin",
                "Content-Length",
                "TrailingHeaders");
        });
    }
Beispiel #17
0
 public static void Initialize()
 {
     XunitContext.Init();
     LocalDbLogging.EnableVerbose();
     LocalDbSettings.ConnectionBuilder((instance, database) => $"Data Source=(LocalDb)\\{instance};Database={database};Pooling=true;Connection Timeout=300");
     VerifierSettings.ScrubLinesContaining("filename = '");
     VerifierSettings.ModifySerialization(settings =>
     {
         settings.IgnoreMember <LocalDbInstanceInfo>(x => x.OwnerSID);
         settings.IgnoreMember <LocalDbInstanceInfo>(x => x.Connection);
         settings.IgnoreMember <LocalDbInstanceInfo>(x => x.LastStartUtc);
         settings.IgnoreMember <LocalDbInstanceInfo>(x => x.Build);
         settings.IgnoreMember <LocalDbInstanceInfo>(x => x.Major);
         settings.IgnoreMember <LocalDbInstanceInfo>(x => x.Minor);
         settings.IgnoreMember <LocalDbInstanceInfo>(x => x.Revision);
     });
 }
Beispiel #18
0
 public static void Init()
 {
     VerifierSettings.ModifySerialization(
         settings => settings.MemberConverter <Breadcrumb, IReadOnlyDictionary <string, string> >(
             target => target.Data,
             (_, value) =>
     {
         var dictionary = new Dictionary <string, string>();
         foreach (var pair in value)
         {
             if (pair.Key == "stackTrace")
             {
                 dictionary[pair.Key] = Scrubbers.ScrubStackTrace(pair.Value, true);
             }
             else
             {
                 dictionary[pair.Key] = pair.Value.Replace('\\', '/');
             }
         }
         return(dictionary);
     }));
 }
Beispiel #19
0
    public static void Initialize()
    {
        var nsbVersion       = FileVersionInfo.GetVersionInfo(typeof(Endpoint).Assembly.Location);
        var nsbVersionString = $"{nsbVersion.FileMajorPart}.{nsbVersion.FileMinorPart}.{nsbVersion.FileBuildPart}";

        VerifierSettings.ScrubLinesContaining("StackTraceString");
        VerifierSettings.ScrubLinesContaining("NServiceBus.TimeSent");
        VerifierSettings.ScrubLinesContaining("HandlerStartTime");
        VerifierSettings.ScrubLinesContaining("HandlerFailureTime");
        VerifierSettings.AddScrubber(x => x.Replace(nsbVersionString, "NsbVersion"));
        VerifierSettings.ScrubMachineName();
        VerifierSettings.ModifySerialization(settings =>
        {
            settings.AddExtraSettings(newtonsoft =>
            {
                newtonsoft.Converters.Add(new LogEventPropertyConverter());
                newtonsoft.Converters.Add(new LogEventConverter());
                newtonsoft.Converters.Add(new ScalarValueConverter());
            });
        });
        VerifierSettings.AddExtraDatetimeFormat("yyyy-MM-dd HH:mm:ss:ffffff Z");
    }
Beispiel #20
0
 void ScrubInlineGuids()
 {
     #region ScrubInlineGuids
     VerifierSettings.ModifySerialization(_ => _.ScrubInlineGuids());
     #endregion
 }