NUnit.Framework.TestCaseData.Returns C# (CSharp) Method

Returns() public method

Sets the expected result for the test
public Returns ( object result ) : TestCaseData
result object The expected result
return TestCaseData
        public TestCaseData Returns(object result)
        {
            this.result = result;
            return this;
        }

Usage Example

        private static TestCaseData GetTestCaseData(string name)
        {
            var asm = Assembly.GetExecutingAssembly();
            var originalStream = asm.GetManifestResourceStream(typeof (_Dummy), name + ".txt");
            var goldStream = asm.GetManifestResourceStream(typeof (_Dummy), name + ".gold");

            Debug.Assert(originalStream != null, "originalStream != null");
            Debug.Assert(goldStream != null, "goldStream != null");

            string original;
            string gold;

            using (var streamReader = new StreamReader(originalStream, Encoding.UTF8))
                original = streamReader.ReadToEnd();

            using (var streamReader = new StreamReader(goldStream, Encoding.UTF8))
                gold = streamReader.ReadToEnd();

            var testCaseData = new TestCaseData(original);

            testCaseData.SetName(name);
            testCaseData.Returns(gold.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries));

            return testCaseData;
        }
All Usage Examples Of NUnit.Framework.TestCaseData::Returns