コード例 #1
0
        protected override bool Process(IInteraction parameters)
        {
            TestContextInteraction testContext = null;
            IncomingTestData       testInput   = null;
            OutgoingTestableData   testOutput  = null;
            IInteraction           testBundle;
            bool success;

            testBundle = testContext = new TestContextInteraction(this.Name, this.AvailableContext);

            if (HasIngoingData)
            {
                testBundle = testInput = new IncomingTestData(this.IngoingDataFile, testBundle, this.SourceName, this.IngoingContentType);
            }

            if (HasOutgoingDataViewer)
            {
                testBundle = testOutput = new OutgoingTestableData(testBundle);
            }

            success = this.TestSubject.TryProcess(testBundle);

            if (HasIngoingData)
            {
                testInput.Dispose();
            }

            if (HasOutgoingDataViewer)
            {
                // obscure name of the year award goes to
                IInteraction incomingInteractionWithOutgoingData;
                incomingInteractionWithOutgoingData = new SimpleIncomingInteraction(testOutput.GetProduct(), parameters, "test-case-output", this.IngoingContentType);

                success &= this.OutgoingDataViewer.TryProcess(incomingInteractionWithOutgoingData);

                testOutput.Dispose();
            }

            foreach (ProbeResultInteraction result in testContext.ProbeResults)
            {
                if (result.IsMatch)
                {
                    success &= this.MatchingProbeResultViewer.TryProcess(result);
                }
                else
                {
                    success &= this.MismatchingProbeResultViewer.TryProcess(result);
                }
            }

            return(success);
        }
コード例 #2
0
        protected override bool Process(IInteraction parameters)
        {
            TestContextInteraction testContext = (TestContextInteraction)parameters.GetClosest(typeof(TestContextInteraction));

            Settings probeValues = this.Settings.GetSubsettings(testContext.OriginatingCaseName);

            foreach (string key in probeValues.Dictionary.Keys)
            {
                object measuredValue = null;
                ProbeResultInteraction probeResult;

                parameters.TryGetFallback(key, out measuredValue);
                probeResult = new ProbeResultInteraction(
                    parameters, this.ProbeName, key,
                    probeValues [key], measuredValue);

                testContext.ProbeResults.Add(probeResult);
            }

            return((Branches ["continue"] ?? Stub).TryProcess(parameters));
        }