示例#1
0
 public InnerVerifier(string testName, string sourceFile, Assembly assembly)
 {
     directory     = VerifierSettings.DeriveDirectory(sourceFile, assembly);
     this.testName = testName;
     this.assembly = assembly;
     CounterContext.Start();
 }
示例#2
0
        public InnerVerifier(string testName, string sourceFile, Assembly assembly, VerifySettings settings)
        {
            var projectDirectory = AttributeReader.GetProjectDirectory(assembly);

            directory     = VerifierSettings.DeriveDirectory(sourceFile, projectDirectory);
            this.testName = testName;
            this.assembly = assembly;
            this.settings = settings;

            var altProjectDirectory        = projectDirectory.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
            var altProjectDirectoryTrimmed = altProjectDirectory.TrimEnd('/', '\\');
            var projectDirectoryTrimmed    = projectDirectory.TrimEnd('/', '\\');

            settings.instanceScrubbers.Add(builder =>
            {
                builder.Replace(projectDirectory, "{ProjectDirectory}");
                builder.Replace(projectDirectoryTrimmed, "{ProjectDirectory}");
                builder.Replace(altProjectDirectory, "{ProjectDirectory}");
                builder.Replace(altProjectDirectoryTrimmed, "{ProjectDirectory}");
            });

            if (AttributeReader.TryGetSolutionDirectory(assembly, out var solutionDirectory))
            {
                var altSolutionDirectory        = solutionDirectory !.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
                var altSolutionDirectoryTrimmed = altSolutionDirectory.TrimEnd('/', '\\');
                var solutionDirectoryTrimmed    = solutionDirectory.TrimEnd('/', '\\');
                settings.instanceScrubbers.Add(builder =>
                {
                    builder.Replace(solutionDirectory, "{SolutionDirectory}");
                    builder.Replace(solutionDirectoryTrimmed, "{SolutionDirectory}");
                    builder.Replace(altSolutionDirectory, "{SolutionDirectory}");
                    builder.Replace(altSolutionDirectoryTrimmed, "{SolutionDirectory}");
                });
            }


            CounterContext.Start();
        }