Opc.Ua.ServerTest.WriteTest.Run C# (CSharp) Method

Run() public method

Runs the test for all of the browse roots.
public Run ( ServerTestCase testcase, int iteration ) : bool
testcase ServerTestCase
iteration int
return bool
        public override bool Run(ServerTestCase testcase, int iteration)
        {
            try
            {
                LockServer();

                Iteration = iteration;

                if (ReadOnlyTests)
                {
                    Log("WARNING: TestCase {0} skipped because client could not acquire a lock on the Server.", testcase.Name);
                    return true;
                }

                // need fetch nodes used for the test if not already available.
                if (AvailableNodes.Count == 0)
                {
                    if (!GetNodesInHierarchy())
                    {
                        return false;
                    }
                }

                // get the writeable variables.
                if (WriteableVariables.Count == 0)
                {
                    if (!GetWriteableVariablesInHierarchy())
                    {
                        Log("WARNING: No writeable variables found.");
                        Log(g_WriteableVariableHelpText);
                        return true;
                    }
                }

                // do secondary test.
                switch (testcase.Name)
                {
                    case "TypeMismatch":
                    {
                        return DoWriteBadTypeTest();
                    }

                    default:
                    {
                        return DoWriteTest();
                    }
                }
            }
            finally
            {
                UnlockServer();
            }
        }        
        #endregion