Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeToMap()
        public virtual void ShouldSerializeToMap()
        {
            IDictionary <string, object> values = new Dictionary <string, object>();

            values["string"]       = "value";
            values["int"]          = 5;
            values["long"]         = 17L;
            values["double"]       = 3.14;
            values["float"]        = 42.0f;
            values["string array"] = new string[] { "one", "two" };
            values["long array"]   = new long[] { 5L, 17L };
            values["double array"] = new double[] { 3.14, 42.0 };

            PropertiesRepresentation     properties = new PropertiesRepresentation(Container(values));
            IDictionary <string, object> map        = serialize(properties);

            assertEquals("value", map["string"]);
            assertEquals(5, (( Number )map["int"]).longValue());
            assertEquals(17, (( Number )map["long"]).longValue());
            assertEquals(3.14, (( Number )map["double"]).doubleValue(), 0.0);
            assertEquals(42.0, (( Number )map["float"]).doubleValue(), 0.0);
            AssertEqualContent(Arrays.asList("one", "two"), (System.Collections.IList)map["string array"]);
            AssertEqualContent(Arrays.asList(5L, 17L), (System.Collections.IList)map["long array"]);
            AssertEqualContent(Arrays.asList(3.14, 42.0), (System.Collections.IList)map["double array"]);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToSignalEmptiness()
        public virtual void ShouldBeAbleToSignalEmptiness()
        {
            PropertiesRepresentation     properties = new PropertiesRepresentation(Container(new Dictionary <string, object>()));
            IDictionary <string, object> values     = new Dictionary <string, object>();

            values["key"] = "value";
            assertTrue(properties.Empty);
            properties = new PropertiesRepresentation(Container(values));
            assertFalse(properties.Empty);
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeToMapWithSamePropertiesWhenCreatedFromPropertyContainer()
        public virtual void ShouldSerializeToMapWithSamePropertiesWhenCreatedFromPropertyContainer()
        {
            IDictionary <string, object> values = new Dictionary <string, object>();

            values["foo"] = "bar";
            PropertiesRepresentation     properties = new PropertiesRepresentation(Container(values));
            IDictionary <string, object> map        = serialize(properties);

            assertEquals(values, map);
        }