public void CanCreateShortValueOrString_FromLong(long value)
        {
            ShortValueOrString s = value;

            Assert.IsTrue(s.IsValue);
            Assert.AreEqual(SimpleValueType.Long, s.Value.ValueType);
        }
        public void CanCreateShortValueOrString_FromShort(short value)
        {
            ShortValueOrString s = value;

            Assert.IsTrue(s.IsValue);
            Assert.AreEqual(SimpleValueType.Short, s.Value.ValueType);
        }
        public void CanCreateShortValueOrString_FromChar(char value)
        {
            ShortValueOrString s = value;

            Assert.IsTrue(s.IsValue);
            Assert.AreEqual(SimpleValueType.Char, s.Value.ValueType);
        }
        public void CanCreateShortValueOrString_FromDouble(double value)
        {
            ShortValueOrString s = value;

            Assert.IsTrue(s.IsValue);
            Assert.AreEqual(SimpleValueType.Double, s.Value.ValueType);
        }
        public void CanCreateShortValueOrString_FromNull()
        {
            ShortValueOrString s = null;

            Assert.IsFalse(s.IsValue);
            Assert.IsNull(s.Reference);
        }
        public void CanCreateShortValueOrString_FromString(string value)
        {
            ShortValueOrString s = value;

            Assert.IsFalse(s.IsValue);
            Assert.AreSame(value, s.Reference);
        }
        public void CanCreateShortValueOrString_FromTimeSpan(TimeSpan value)
        {
            ShortValueOrString s = value;

            Assert.IsTrue(s.IsValue);
            Assert.AreEqual(SimpleValueType.TimeSpan, s.Value.ValueType);
        }
        public void CanCreateShortValueOrString_FromBool(bool value)
        {
            ShortValueOrString s = value;

            Assert.IsTrue(s.IsValue);
            Assert.AreEqual(SimpleValueType.Bool, s.Value.ValueType);
        }
        public void ReferenceTypeThrows_OnAccessingValue(string value)
        {
            ShortValueOrString s = value;

            Assert.Throws <InvalidOperationException>(() => { _ = s.Value; });
        }
示例#10
0
        public void SimpleTypeThrows_OnAccessingReference(int value)
        {
            ShortValueOrString s = value;

            Assert.Throws <InvalidOperationException>(() => { _ = s.Reference; });
        }
 public string ShortValueOrString_ToString(ShortValueOrString value)
 {
     return(value.ToString());
 }