Samples/UnitTesting/QuantumSimulatorTestTargets.cs
/// <summary>All Q# procedures ending with Test in the same namespace as this class are 
/// discovered and passed to this function as an argument. 
/// </summary>
All Q# procedures ending with Test in the same namespace as this class are
discovered and passed to this function as an argument.
All Q# procedures ending with Test in the same namespace as this class are discovered and passed to this function as an argument .
[OperationDriver]
        public void QuantumSimulatorTarget(TestOperation operationDescription)
        {
            try
            {
                using (var sim = new QuantumSimulator())
                {
                    output.WriteLine($"The seed used for this test is {sim.Seed}");
                    Debug.WriteLine($"The seed used for this test is {sim.Seed}");
                    sim.OnLog += (string message) => { Debug.WriteLine(message); };
                    sim.OnLog += (string message) => { output.WriteLine(message); };
                    operationDescription.TestOperationRunner(sim);
                }
            }
            catch (System.BadImageFormatException e)
            {
                throw new System.BadImageFormatException($"Could not load Quantum Simulator. If you are running tests using Visual Studio 2017, " +
                    $"this problem can be fixed by using menu Test > Test Settings > Default Processor Architecture " +
                    $"and switching to X64 instead of X86. Alternatively, press Ctrl+Q and type `Default Processor Architecture`. If you are running from command line using " +
                    $"vstest.console.exe use command line option /Platform:x64.", e);
            }
        }
[ OperationDriver ] public void QuantumSimulatorTarget ( TestOperation operationDescription ) { try { using ( var sim = new QuantumSimulator ( ) ) { output . WriteLine ( $" The seed used for this test is  { sim . Seed } " ) ; Debug . WriteLine ( $" The seed used for this test is  { sim . Seed } " ) ; sim . OnLog += ( string message ) => { Debug . WriteLine ( message ) ; } ; sim . OnLog += ( string message ) => { output . WriteLine ( message ) ; } ; operationDescription . TestOperationRunner ( sim ) ; } } catch ( System . BadImageFormatException e ) { throw new System . BadImageFormatException ( $" Could not load Quantum Simulator. If you are running tests using Visual Studio 2017,  " + $" this problem can be fixed by using menu Test > Test Settings > Default Processor Architecture  " + $" and switching to X64 instead of X86. Alternatively, press Ctrl+Q and type `Default Processor Architecture`. If you are running from command line using  " + $" vstest.console.exe use command line option /Platform:x64. " , e ) ; } }
All Q# procedures ending with Test in the same namespace as this class are
discovered and passed to this function as an argument.
All Q# procedures ending with Test in the same namespace as this class are discovered and passed to this function as an argument .
// Frequently tests include measurement and randomness.  // To reproduce the failed test it is useful to record seed that has been used  // for the random number generator inside the simulator. // This ensures that when the test is run in Debug mode, all message logged in  // Q# by calling Microsoft.Quantum.Primitives.Message show-up  // in Debug output  // this ensures that all message logged in Q# by calling // Microsoft.Quantum.Primitives.Message show-up  // in test output  // Executes operation described by operationDescription on a QuantumSimulator
operationDescription
TestOperation