예제 #1
0
        private static ImmutableReferenceData baseData2()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> dataMap = com.google.common.collect.ImmutableMap.of(ID1, VAL3, ID3, VAL3);
            IDictionary <ReferenceDataId <object>, object> dataMap = ImmutableMap.of(ID1, VAL3, ID3, VAL3);

            return(ImmutableReferenceData.of(dataMap));
        }
        public virtual void test_serialization()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> dataMap = com.google.common.collect.ImmutableMap.of(ID1, VAL1);
            IDictionary <ReferenceDataId <object>, object> dataMap = ImmutableMap.of(ID1, VAL1);
            ReferenceData test = ImmutableReferenceData.of(dataMap);

            assertSerialization(test);
        }
        //-------------------------------------------------------------------------
        public virtual void test_combinedWith_IRD_other_noClash()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> dataMap1 = com.google.common.collect.ImmutableMap.of(ID1, VAL1);
            IDictionary <ReferenceDataId <object>, object> dataMap1 = ImmutableMap.of(ID1, VAL1);
            ImmutableReferenceData test1 = ImmutableReferenceData.of(dataMap1);

            ReferenceData test = test1.combinedWith(REF_DATA2);

            assertEquals(test.getValue(ID1), VAL1);
            assertEquals(test.getValue(ID2), VAL2);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> dataMap = com.google.common.collect.ImmutableMap.of(ID1, VAL1);
            IDictionary <ReferenceDataId <object>, object> dataMap = ImmutableMap.of(ID1, VAL1);
            ImmutableReferenceData test = ImmutableReferenceData.of(dataMap);

            coverImmutableBean(test);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> dataMap2 = com.google.common.collect.ImmutableMap.of(ID2, VAL2);
            IDictionary <ReferenceDataId <object>, object> dataMap2 = ImmutableMap.of(ID2, VAL2);
            ImmutableReferenceData test2 = ImmutableReferenceData.of(dataMap2);

            coverBeanEquals(test, test2);

            coverPrivateConstructor(typeof(StandardReferenceData));
        }
        public virtual void test_of_single()
        {
            ReferenceData test = ImmutableReferenceData.of(ID1, VAL1);

            assertEquals(test.containsValue(HolidayCalendarIds.NO_HOLIDAYS), false);
            assertEquals(test.containsValue(HolidayCalendarIds.SAT_SUN), false);
            assertEquals(test.containsValue(HolidayCalendarIds.FRI_SAT), false);
            assertEquals(test.containsValue(HolidayCalendarIds.THU_FRI), false);

            assertEquals(test.containsValue(ID1), true);
            assertEquals(test.getValue(ID1), VAL1);
            assertEquals(test.findValue(ID1), VAL1);

            assertEquals(test.containsValue(ID2), false);
            assertThrows(() => test.getValue(ID2), typeof(ReferenceDataNotFoundException));
            assertEquals(test.findValue(ID2), null);
        }
        public override ReferenceData combinedWith(ReferenceData other)
        {
            if (other is ImmutableReferenceData)
            {
                ImmutableReferenceData otherData = (ImmutableReferenceData)other;
                // hash map so that keys can overlap, with this instance taking priority
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> combined = new java.util.HashMap<>();
                IDictionary <ReferenceDataId <object>, object> combined = new Dictionary <ReferenceDataId <object>, object>();
//JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'putAll' method:
                combined.putAll(otherData.values);
//JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'putAll' method:
                combined.putAll(this.values);
                return(new ImmutableReferenceData(combined));
            }
            return(ReferenceData.this.combinedWith(other));
        }
        static StandardReferenceData()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> map = new java.util.HashMap<>();
            IDictionary <ReferenceDataId <object>, object> map = new Dictionary <ReferenceDataId <object>, object>();

            foreach (HolidayCalendar cal in HolidayCalendars.extendedEnum().lookupAllNormalized().values())
            {
                map[cal.Id] = cal;
            }
            STANDARD = ImmutableReferenceData.of(map);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: com.google.common.collect.ImmutableMap.Builder<ReferenceDataId<?>, Object> builder = com.google.common.collect.ImmutableMap.builder();
            ImmutableMap.Builder <ReferenceDataId <object>, object> builder = ImmutableMap.builder();
            builder.put(HolidayCalendars.NO_HOLIDAYS.Id, HolidayCalendars.NO_HOLIDAYS);
            builder.put(HolidayCalendars.SAT_SUN.Id, HolidayCalendars.SAT_SUN);
            builder.put(HolidayCalendars.FRI_SAT.Id, HolidayCalendars.FRI_SAT);
            builder.put(HolidayCalendars.THU_FRI.Id, HolidayCalendars.THU_FRI);
            MINIMAL = ImmutableReferenceData.of(builder.build());
        }
        public virtual void test_of_IRD()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<ReferenceDataId<?>, Object> dataMap = com.google.common.collect.ImmutableMap.of(ID1, VAL1, ID2, VAL2);
            IDictionary <ReferenceDataId <object>, object> dataMap = ImmutableMap.of(ID1, VAL1, ID2, VAL2);
            ImmutableReferenceData test = ImmutableReferenceData.of(dataMap);

            assertEquals(test.containsValue(HolidayCalendarIds.NO_HOLIDAYS), false);
            assertEquals(test.containsValue(HolidayCalendarIds.SAT_SUN), false);
            assertEquals(test.containsValue(HolidayCalendarIds.FRI_SAT), false);
            assertEquals(test.containsValue(HolidayCalendarIds.THU_FRI), false);

            assertEquals(test.containsValue(ID1), true);
            assertEquals(test.getValue(ID1), VAL1);
            assertEquals(test.findValue(ID1), VAL1);

            assertEquals(test.containsValue(ID2), true);
            assertEquals(test.getValue(ID2), VAL2);
            assertEquals(test.findValue(ID2), VAL2);

            assertEquals(test.containsValue(ID3), false);
            assertThrows(() => test.getValue(ID3), typeof(ReferenceDataNotFoundException));
            assertEquals(test.findValue(ID3), null);
        }