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

SetProperty() public method

Applies a named property to the test
public SetProperty ( string propName, double propValue ) : TestCaseData
propName string
propValue double
return TestCaseData
        public TestCaseData SetProperty(string propName, double propValue)
        {
            this.Properties.Add(propName, propValue);
            return this;
        }

Same methods

TestCaseData::SetProperty ( string propName, int propValue ) : TestCaseData
TestCaseData::SetProperty ( string propName, string propValue ) : TestCaseData

Usage Example

Example #1
0
            public static IEnumerable<TestCaseData> LexerFailureCases()
            {
                var f = TestUtils.GetTestPath(@"IronLua.Tests\Scripts\Lexer01_XXX.lua");

                using (var reader = File.OpenText(f))
                {
                    var snippet = new StringBuilder();
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (line.StartsWith("--XX") || line.StartsWith("--::"))
                        {
                            // failure cases
                            var testData = snippet.ToString();
                            var expect = line.TrimStart('-', 'X', ':').Trim();

                            var testCaseData = new TestCaseData(testData, expect);

                            if (line.StartsWith("--XX"))
                                testCaseData.SetProperty("FailureCase", 1);

                            testCaseData.SetName(testData);
                            yield return testCaseData;

                            snippet.Clear();
                        }
                        else if (!line.StartsWith("--"))
                        {
                            snippet.Append(line);
                        }
                    }
                }
            }
All Usage Examples Of NUnit.Framework.TestCaseData::SetProperty