System.Xml.Tests.TCFullEndElement.TCEntityRef.entityRef_1 C# (CSharp) Method

entityRef_1() public method

public entityRef_1 ( ) : int
return int
            public int entityRef_1()
            {
                string temp = null;
                switch (CurVariation.Param.ToString())
                {
                    case "null":
                        temp = null;
                        break;
                    case "String.Empty":
                        temp = String.Empty;
                        break;
                    default:
                        temp = CurVariation.Param.ToString();
                        break;
                }
                using (XmlWriter w = CreateWriter())
                {
                    try
                    {
                        w.WriteStartElement("Root");
                        w.WriteEntityRef(temp);
                        w.WriteEndElement();
                    }
                    catch (ArgumentException e)
                    {
                        CError.WriteLineIgnore("Exception: " + e.ToString());
                        CError.Compare(w.WriteState, (WriterType == WriterType.CharCheckingWriter) ? WriteState.Element : WriteState.Error, "WriteState should be Error");
                        return TEST_PASS;
                    }
                    catch (NullReferenceException e)
                    {
                        CError.WriteLineIgnore("Exception: " + e.ToString());
                        CError.Compare(w.WriteState, (WriterType == WriterType.CharCheckingWriter) ? WriteState.Element : WriteState.Error, "WriteState should be Error");
                        return TEST_PASS;
                    }
                }
                CError.WriteLine("Did not throw error");
                return TEST_FAIL;
            }