// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; /// /// System.Boolean.ToString() /// public class BooleanToString { const string cTRUE = "True"; const string cFALSE = "False"; #region Main Entry public static int Main() { BooleanToString testCase = new BooleanToString(); TestLibrary.TestFramework.BeginTestCase("Boolean.ToString"); if (testCase.RunTests()) { TestLibrary.TestFramework.EndTestCase(); TestLibrary.TestFramework.LogInformation("PASS"); return 100; } else { TestLibrary.TestFramework.EndTestCase(); TestLibrary.TestFramework.LogInformation("FAIL"); return 0; } } #endregion public bool RunTests() { bool retVal = true; TestLibrary.TestFramework.LogInformation("[Positive]"); retVal = PosTest1() && retVal; retVal = PosTest2() && retVal; return retVal; } public bool PosTest1() { bool retVal = true; try { if (true.ToString() != cTRUE) { TestLibrary.TestFramework.LogError("001", "expect true.ToString() != \"True\""); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e); retVal = false; } return retVal; } public bool PosTest2() { bool retVal = true; try { if (false.ToString() != cFALSE) { TestLibrary.TestFramework.LogError("002", "expect false.ToString() != \"False\""); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e); retVal = false; } return retVal; } }