当前位置: 首页>>代码示例>>C#>>正文


C# DynamicDictionaryValue类代码示例

本文整理汇总了C#中DynamicDictionaryValue的典型用法代码示例。如果您正苦于以下问题:C# DynamicDictionaryValue类的具体用法?C# DynamicDictionaryValue怎么用?C# DynamicDictionaryValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DynamicDictionaryValue类属于命名空间,在下文中一共展示了DynamicDictionaryValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_be_able_to_call_ConvertToBoolean

 public void Should_be_able_to_call_ConvertToBoolean()
 {
     const bool expected = true;
     object value = new DynamicDictionaryValue(expected);
     var actual = Convert.ToBoolean(value);
     Assert.Equal(expected, actual);
 }
开发者ID:ryanki1,项目名称:Nancy,代码行数:7,代码来源:DynamicDictionaryValueFixture.cs

示例2: Should_be_able_to_call_ConvertToInt16

 public void Should_be_able_to_call_ConvertToInt16()
 {
     const short expected = 42;
     object value = new DynamicDictionaryValue(expected);
     var actual = Convert.ToInt16(value);
     Assert.Equal(expected, actual);
 }
开发者ID:ryanki1,项目名称:Nancy,代码行数:7,代码来源:DynamicDictionaryValueFixture.cs

示例3: Should_be_able_to_call_ConvertToDateTime

 public void Should_be_able_to_call_ConvertToDateTime()
 {
     DateTime expected = new DateTime(1952, 3, 11);
     object value = new DynamicDictionaryValue(expected);
     var actual = Convert.ToDateTime(value);
     Assert.Equal(expected, actual);
 }
开发者ID:ryanki1,项目名称:Nancy,代码行数:7,代码来源:DynamicDictionaryValueFixture.cs

示例4: Should_be_able_to_call_ConvertToChar

 public void Should_be_able_to_call_ConvertToChar()
 {
     const char expected = 'a';
     object value = new DynamicDictionaryValue(expected);
     var actual = Convert.ToChar(value);
     Assert.Equal(expected, actual);
 }
开发者ID:ryanki1,项目名称:Nancy,代码行数:7,代码来源:DynamicDictionaryValueFixture.cs

示例5: Should_be_able_to_call_ConvertChangeType

 public void Should_be_able_to_call_ConvertChangeType()
 {
     const int expected = 42;
     object value = new DynamicDictionaryValue(expected);
     var actual = Convert.ChangeType(value, typeof(int));
     Assert.Equal(expected, actual);
 }
开发者ID:ryanki1,项目名称:Nancy,代码行数:7,代码来源:DynamicDictionaryValueFixture.cs

示例6: Integer_dictionary_values_are_Json_serialized_as_integers

        public void Integer_dictionary_values_are_Json_serialized_as_integers()
        {
            dynamic value = 42;
            var input = new DynamicDictionaryValue(value);

            var sut = new Json.JavaScriptSerializer();
            var actual = sut.Serialize(input);

            actual.ShouldEqual(@"42");
        }
开发者ID:DarrellMozingo,项目名称:Nancy,代码行数:10,代码来源:DynamicDictionaryFixture.cs

示例7: Should_be_able_to_implictly_cast_long_to_other_value_types

        public void Should_be_able_to_implictly_cast_long_to_other_value_types()
        {
            // Given
            dynamic valueLong = new DynamicDictionaryValue((long)10);

            // Then
            Assert.Equal(10, valueLong);
            Assert.Equal(10.0, valueLong);
            Assert.Equal(10M, valueLong);
        }
开发者ID:simsod,项目名称:Nancy,代码行数:10,代码来源:DynamicDictionaryValueFixture.cs

示例8: Should_return_true_when_value_is_null_and_compared_with_null_using_equality_operator

        public void Should_return_true_when_value_is_null_and_compared_with_null_using_equality_operator()
        {
            // Given
            var value = new DynamicDictionaryValue(null);

            // When
            var result = (value == null);

            // Then
            result.ShouldBeTrue();
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:11,代码来源:DynamicDictionaryValueFixture.cs

示例9: Should_return_false_when_value_is_not_null_and_compared_with_non_equal_value_using_equality_operator

        public void Should_return_false_when_value_is_not_null_and_compared_with_non_equal_value_using_equality_operator()
        {
            // Given
            var value = new DynamicDictionaryValue(10);

            // When
            var result = (value == 11);

            // Then
            result.ShouldBeFalse();
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:11,代码来源:DynamicDictionaryValueFixture.cs

示例10: Should_return_true_when_hasvalue_is_checked_when_value_is_null

        public void Should_return_true_when_hasvalue_is_checked_when_value_is_null()
        {
            // Given
            var value = new DynamicDictionaryValue(string.Empty);

            // When
            var result = value.HasValue;

            // Then
            result.ShouldBeTrue();
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:11,代码来源:DynamicDictionaryValueFixture.cs

示例11: Should_return_false_when_hasvalue_is_checked_when_value_is_not_null

        public void Should_return_false_when_hasvalue_is_checked_when_value_is_not_null()
        {
            // Given
            var value = new DynamicDictionaryValue(null);

            // When
            var result = value.HasValue;

            // Then
            result.ShouldBeFalse();
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:11,代码来源:DynamicDictionaryValueFixture.cs

示例12: Should_be_able_to_call_ConvertToByte

        public void Should_be_able_to_call_ConvertToByte()
        {
            //Given
            const byte expected = 42;
            object value = new DynamicDictionaryValue(expected);

            //When
            var actual = Convert.ToByte(value);

            //Then
            Assert.Equal(expected, actual);
        }
开发者ID:rstat1,项目名称:Nancy,代码行数:12,代码来源:DynamicDictionaryValueFixture.cs

示例13: String_dictionary_values_are_Json_serialized_as_strings

        public void String_dictionary_values_are_Json_serialized_as_strings()
        {
            //Given
            dynamic value = "42";
            var input = new DynamicDictionaryValue(value);

            //When
            var actual = SimpleJson.SerializeObject(input, new NancySerializationStrategy());

            //Then
            actual.ShouldEqual(@"""42""");
        }
开发者ID:uliian,项目名称:Nancy,代码行数:12,代码来源:SimpleJsonFixture.cs

示例14: Should_return_false_when_value_is_0_and_implicitly_cast_to_bool

        public void Should_return_false_when_value_is_0_and_implicitly_cast_to_bool()
        {
            // Given, When
            dynamic valueInt = new DynamicDictionaryValue(0);
            dynamic valueFloat = new DynamicDictionaryValue(0.0);
            dynamic valueDec = new DynamicDictionaryValue(0.0M);

            // Then
            Assert.False(valueInt);
            Assert.False(valueFloat);
            Assert.False(valueDec);
        }
开发者ID:simsod,项目名称:Nancy,代码行数:12,代码来源:DynamicDictionaryValueFixture.cs

示例15: Should_implicitly_convert_from_string_based_on_given_generic_type_of_datetime

        public void Should_implicitly_convert_from_string_based_on_given_generic_type_of_datetime()
        {
            //Given
            DateTime expected = DateTime.Parse("13 Dec, 2012");
            dynamic value = new DynamicDictionaryValue("13 December 2012");

            //When
            DateTime actual = value.TryParse<DateTime>();

            //Then
            Assert.Equal(expected, actual);
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:12,代码来源:DynamicDictionaryValueFixture.cs


注:本文中的DynamicDictionaryValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。