public void GetFormat()
        {
            DateTimeFormatInfo expected = new DateTimeFormatInfo();
            DateTimeFormatInfo format   = (DateTimeFormatInfo)expected.GetFormat(typeof(DateTimeFormatInfo));

            Assert.Same(expected, format);
        }
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Call GetFormat to to get an valid DateTimeFormatInfo instance");

        try
        {
            DateTimeFormatInfo expected = new DateTimeFormatInfo();
            object             obj      = expected.GetFormat(typeof(DateTimeFormatInfo));

            if (!(obj is DateTimeFormatInfo))
            {
                TestLibrary.TestFramework.LogError("001.1", "Calling GetFormat returns a non DateTimeFormatInfo instance");
                retVal = false;
            }

            DateTimeFormatInfo actual = obj as DateTimeFormatInfo;
            if (actual != expected)
            {
                TestLibrary.TestFramework.LogError("001.2", "Calling GetFormat returns wrong instance");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Call GetFormat to to get an valid DateTimeFormatInfo instance");

        try
        {
            DateTimeFormatInfo expected = new DateTimeFormatInfo();
            object obj = expected.GetFormat(typeof(DateTimeFormatInfo));

            if (!(obj is DateTimeFormatInfo))
            {
                TestLibrary.TestFramework.LogError("001.1", "Calling GetFormat returns a non DateTimeFormatInfo instance");
                retVal = false;
            }

            DateTimeFormatInfo actual = obj as DateTimeFormatInfo;
            if (actual != expected)
            {
                TestLibrary.TestFramework.LogError("001.2", "Calling GetFormat returns wrong instance");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 4
0
        public void PosTest1()
        {
            DateTimeFormatInfo expected = new DateTimeFormatInfo();
            object             obj      = expected.GetFormat(typeof(DateTimeFormatInfo));

            Assert.True(obj is DateTimeFormatInfo);

            DateTimeFormatInfo actual = obj as DateTimeFormatInfo;

            Assert.Equal(expected, actual);
        }
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: If the format type is not supported, null reference should be return");

        try
        {
            DateTimeFormatInfo info = new DateTimeFormatInfo();
            if (info.GetFormat(typeof(Object)) != null)
            {
                TestLibrary.TestFramework.LogError("002.1", "If the format type is not supported, null reference is not returned");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.0", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: If the format type is not supported, null reference should be return");

        try
        {
            DateTimeFormatInfo info = new DateTimeFormatInfo();
            if (info.GetFormat(typeof(Object)) != null)
            {
                TestLibrary.TestFramework.LogError("002.1", "If the format type is not supported, null reference is not returned");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.0", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 7
0
        public void TestUnsupportedFormatType()
        {
            DateTimeFormatInfo info = new DateTimeFormatInfo();

            Assert.Null(info.GetFormat(typeof(Object)));
        }
        public void GetFormat_UnsupportedFormatType_ReturnsNull()
        {
            DateTimeFormatInfo info = new DateTimeFormatInfo();

            Assert.Null(info.GetFormat(typeof(object)));
        }
Ejemplo n.º 9
0
 public void GetFormat_UnsupportedFormatType_ReturnsNull()
 {
     DateTimeFormatInfo info = new DateTimeFormatInfo();
     Assert.Null(info.GetFormat(typeof(object)));
 }
Ejemplo n.º 10
0
 public void GetFormat()
 {
     DateTimeFormatInfo expected = new DateTimeFormatInfo();
     DateTimeFormatInfo format = (DateTimeFormatInfo)expected.GetFormat(typeof(DateTimeFormatInfo));
     Assert.Same(expected, format);
 }