public void PIStateSetsTest()
        {
            PIServer     piServer  = PIFixture.PIServer;
            const string TestState = "|[]{}:;<>,.?/\\\"'~`";

            string[] setValues = { string.Empty, null, "(!@#$%^&*+-=)", "    ", "valid", "valid", "    test    ", "   test       ", TestState };

            const string SetName = "PIStateSetsTests";

            try
            {
                // Create
                Output.WriteLine($"Creating digital state set [{SetName}] on [{piServer.Name}].");
                var set        = piServer.StateSets.Add(SetName);
                var stateCount = 0;
                foreach (var state in setValues)
                {
                    set.Add(state, stateCount++);
                }

                set.CheckIn();
                piServer.Refresh();

                // Read
                Output.WriteLine($"Reading digital state set [{SetName}] on [{piServer.Name}].");
                var actualSet = piServer.StateSets[SetName];
                Assert.True(actualSet != null, $"The digital state set [{SetName}] could not be read.");
                Assert.True(actualSet.Contains(TestState), $"The digital state set [{SetName}] did not contain the state [{TestState}].");

                // Update
                Output.WriteLine($"Removing digital state [{TestState}] in set [{SetName}] on [{piServer.Name}].");
                var lastState = set[TestState];
                set.Remove(lastState);
                set.CheckIn();
                piServer.Refresh();
                actualSet = piServer.StateSets[SetName];
                Assert.False(actualSet.Contains(lastState), $"The digital state set [{set}] still contains the state [{TestState}] after removal.");

                const string TestStateNew = "|[]{}:;<>,.?/\\\"'~`New";
                Output.WriteLine($"Adding digital state [{TestStateNew}] in set [{SetName}] on [{piServer.Name}].");
                set.Add(TestStateNew, lastState.Value);
                set.CheckIn();
                piServer.Refresh();
                actualSet = piServer.StateSets[SetName];
                var newState = set[TestStateNew];
                Assert.True(actualSet.Contains(newState), $"The digital state set [{set}] does not contain the state [{TestStateNew}] after being added.");

                // Delete
                Output.WriteLine($"Removing digital state set [{SetName}] on [{piServer.Name}].");
                piServer.StateSets.Remove(SetName);
                piServer.Refresh();
                actualSet = piServer.StateSets[SetName];
                Assert.True(actualSet == null, $"The digital state set [{SetName}] still exists after deletion.");
            }
            finally
            {
                piServer.Refresh();
                if (piServer.StateSets[SetName] != null)
                {
                    piServer.StateSets.Remove(SetName);
                }
            }
        }