public void Create_ProviderIsNullAndSerializerIsNotNull_PropertiesAsExpected()
        {
            TestFormatProvider     provider   = null;
            TestArgumentSerializer serializer = new TestArgumentSerializer();

            Options actual = Options.Create(provider, serializer);

            Assert.That(actual.Provider, Is.Null);
            Assert.That(actual.Serializer, Is.SameAs(serializer));
            Assert.That(actual.IsLimited, Is.False);
            Assert.That(actual.Maximum, Is.EqualTo(Int32.MaxValue));
            Assert.That(actual.IsFallback, Is.False);
            Assert.That(actual.Fallback, Is.Null);
        }
示例#2
0
    public sbyte ToSByte(IFormatProvider provider)
    {
        bool toMinValue = true;

        if (provider != null)
        {
            TestFormatProvider format = provider.GetFormat(typeof(TestFormatProvider)) as TestFormatProvider;
            if ((format != null) && format.ToSByteMaxValue)
            {
                toMinValue = false;
            }
        }

        if (toMinValue)
        {
            return(SByte.MinValue);
        }
        else
        {
            return(SByte.MaxValue);
        }
    }
示例#3
0
    public long ToInt64(IFormatProvider provider)
    {
        bool toMinValue = true;

        if (provider != null)
        {
            TestFormatProvider format = provider.GetFormat(typeof(TestFormatProvider)) as TestFormatProvider;
            if ((format != null) && format.ToInt16MaxValue)
            {
                toMinValue = false;
            }
        }

        if (toMinValue)
        {
            return(Int64.MinValue);
        }
        else
        {
            return(Int64.MaxValue);
        }
    }