Exemple #1
0
        public void IsValidIdentifier_WithSuspectStateNames_ReturnsExpected()
        {
            TestData[] testDataArray = new TestData[]
            {
                new TestData("", false),
                new TestData("&", false),
                new TestData("6", true),
                new TestData("_", true),
                new TestData("__", true),
                new TestData("__6", true),
                new TestData("__b", true),
                new TestData("B_", true),
                new TestData("6B", false),
                new TestData("B6", true),
                new TestData("__X", true),
                new TestData("X", true),
                new TestData("X\nx", false),
            };

            foreach (TestData testData in testDataArray)
            {
                bool isValid = StateMachineTemplate.IsValidIdentifier(testData.StateName);
                Assert.That(isValid, Is.EqualTo(testData.ExpectedIsValid), "Test string \"" + testData.StateName + "\" didn't match expectation.");
            }
        }
Exemple #2
0
 public void IsValidIdentifier_WithNull_Throws()
 {
     Assert.That(() => { StateMachineTemplate.IsValidIdentifier(null); }, Throws.TypeOf(typeof(ArgumentNullException)));
 }