Exemple #1
0
        internal static void Execute(IConfiguration <T> configuration, TestMetadata metadata, T recieved)
        {
            recieved = configuration.Sanitiser.Sanatise(recieved);
            var name             = configuration.Namer.GetName(metadata);
            var approvedFileName = name + ".approved." + configuration.Extension;
            var receivedFileName = name + ".received." + configuration.Extension;

            var result = Compare(configuration, receivedFileName, approvedFileName, recieved);

            if (!result.Passed)
            {
                var reporterRan = RunReporter(configuration, recieved, receivedFileName, approvedFileName);
                if (reporterRan)
                {
                    result = Compare(configuration, receivedFileName, approvedFileName, recieved);
                }
            }

            if (result.Passed)
            {
                return;
            }

            throw new AssentFailedException(result.Error, receivedFileName, approvedFileName);
        }
Exemple #2
0
        public static void Assent(
            this object testFixture,
            string recieved,
            Configuration configuration        = null,
            [CallerMemberName] string testName = null,
            [CallerFilePath] string filePath   = null
            )
        {
            var metadata = new TestMetadata(testFixture, testName, filePath);

            configuration = configuration ?? new Configuration();
            Engine <string> .Execute(configuration, metadata, recieved);
        }