Opc.Ua.ServerTest.ReadTest.Run C# (CSharp) Méthode

Run() public méthode

Runs the test for all of the browse roots.
public Run ( ServerTestCase testcase, int iteration ) : bool
testcase ServerTestCase
iteration int
Résultat bool
        public override bool Run(ServerTestCase testcase, int iteration)
        {
            Iteration = iteration;

            // need fetch nodes used for the test if not already available.
            bool fetched = false;

            if (AvailableNodes.Count == 0)
            {
                fetched = true;

                if (!GetNodesInHierarchy())
                {
                    return false;
                }
            }

            // do secondary test.
            switch (testcase.Name)
            {
                case "IndexRanges":
                {
                    if (fetched)
                    {
                        if (!DoReadTest())
                        {
                            return false;
                        }
                    }

                    return DoReadIndexRangeTest();
                }

                case "DataEncodings":
                {
                    if (fetched)
                    {
                        if (!DoReadTest())
                        {
                            return false;
                        }
                    }

                    return DoReadDataEncodingTest();
                }

                case "ReadWrite":
                {
                    try
                    {
                        LockServer();

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

                        if (fetched)
                        {
                            if (!DoReadTest())
                            {
                                return false;
                            }
                        }

                        return DoReadWriteTest();
                    }
                    finally
                    {
                        UnlockServer();
                    }
                }

                default:
                {
                    return DoReadTest();
                }
            }
        }        
        #endregion