Beispiel #1
0
    //public bool NegTest1()
    //{
    //    bool retVal = true;

    //    TestLibrary.TestFramework.BeginScenario("NegTest1: ");

    //    try
    //    {
    //          //
    //          // Add your test logic here
    //          //
    //    }
    //    catch (Exception e)
    //    {
    //        TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e);
    //        TestLibrary.TestFramework.LogInformation(e.StackTrace);
    //        retVal = false;
    //    }

    //    return retVal;
    //}
    #endregion
    #endregion

    public static int Main()
    {
        EncodingUTF8 test = new EncodingUTF8();

        TestLibrary.TestFramework.BeginTestCase("EncodingUTF8");

        if (test.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }
Beispiel #2
0
    //public bool NegTest1()
    //{
    //    bool retVal = true;

    //    TestLibrary.TestFramework.BeginScenario("NegTest1: ");

    //    try
    //    {
    //          //
    //          // Add your test logic here
    //          //
    //    }
    //    catch (Exception e)
    //    {
    //        TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e);
    //        TestLibrary.TestFramework.LogInformation(e.StackTrace);
    //        retVal = false;
    //    }

    //    return retVal;
    //}
    #endregion
    #endregion

    public static int Main()
    {
        EncodingUTF8 test = new EncodingUTF8();

        TestLibrary.TestFramework.BeginTestCase("EncodingUTF8");

        if (test.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }
Beispiel #3
0
 /// <summary>
 /// Serializa uma string XML com os dados do objeto enviado pelo parâmetro. Se ocorrer algum erro ao desserializar
 /// o objeto retorna uma string vazia
 /// </summary>
 /// <param name="t">Objeto genérico</param>
 /// <returns>string com os dados no formato XML</returns>
 /// <exception cref="ChangeXmlException">Lança a exceção do tipo ChangeXmlException com uma mensagem e internamente as exeções que ocorreram</exception>
 public string serializeXmlForGTE(T t)
 {
     try
     {
         XmlSerializer           xmlSerialize = new XmlSerializer(typeof(T));
         XmlSerializerNamespaces xmlns        = new XmlSerializerNamespaces();
         xmlns.Add("", "");
         StringBuilder stringXml = new StringBuilder();
         using (StringWriter textWriter = new EncodingUTF8(stringXml))
         {
             xmlSerialize.Serialize(textWriter, t, xmlns);
         }
         return(stringXml.ToString());
     }
     catch (Exception ex)
     {
         throw new ChangeXmlException(MessagesOfReturn.ExceptionSerializeXml, ex);
     }
 }