コード例 #1
0
        public void GetYearInfo_should_be_callable_indirectly_against_only_specified_instance()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var calendar = new JapaneseLunisolarCalendar();

                var calendarProxy = new PProxyJapaneseLunisolarCalendar();
                calendarProxy.GetEraDateTime().Body             = (@this, time) => calendar.Eras[0];
                calendarProxy.GetGregorianYearInt32Int32().Body = (@this, year, era) => 2000;
                calendarProxy.GetYearInfoInt32Int32().Body      = (@this, lunarYear, index) => 41;
                var calendar_sut = (JapaneseLunisolarCalendar)calendarProxy;

                // Act
                var actual = calendar_sut.GetLeapMonth(26, calendar.Eras[0]);

                // Assert
                Assert.AreEqual(42, actual);
                Assert.AreNotEqual(calendar.GetLeapMonth(26, calendar.Eras[0]), actual);
            }
        }
コード例 #2
0
        public void CalEraInfo_should_be_callable_indirectly_against_only_specified_instance()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var calendar = new JapaneseLunisolarCalendar();

                var calendarProxy = new PProxyJapaneseLunisolarCalendar();
                var japaneseLunisolarCalendar_get_CalEraInfo = default(MethodInfo);
                var expected = default(Array);
                MakeCalEraInfoTestData(out japaneseLunisolarCalendar_get_CalEraInfo, out expected);
                calendarProxy.CalEraInfoGet().Body = args => expected;
                var calendar_sut = (JapaneseLunisolarCalendar)calendarProxy;


                // Act
                var actual = japaneseLunisolarCalendar_get_CalEraInfo.Invoke(calendar_sut, null) as IEnumerable;


                // Assert
                CollectionAssert.AreEqual(expected, actual);
                CollectionAssert.AreNotEqual(japaneseLunisolarCalendar_get_CalEraInfo.Invoke(calendar, null) as IEnumerable, actual);
            }
        }
コード例 #3
0
        public void GetYearInfo_should_be_callable_indirectly_against_only_specified_instance()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var calendar = new JapaneseLunisolarCalendar();

                var calendarProxy = new PProxyJapaneseLunisolarCalendar();
                calendarProxy.GetEraDateTime().Body = (@this, time) => calendar.Eras[0];
                calendarProxy.GetGregorianYearInt32Int32().Body = (@this, year, era) => 2000;
                calendarProxy.GetYearInfoInt32Int32().Body = (@this, lunarYear, index) => 41;
                var calendar_sut = (JapaneseLunisolarCalendar)calendarProxy;

                // Act
                var actual = calendar_sut.GetLeapMonth(26, calendar.Eras[0]);

                // Assert
                Assert.AreEqual(42, actual);
                Assert.AreNotEqual(calendar.GetLeapMonth(26, calendar.Eras[0]), actual);
            }
        }
コード例 #4
0
        public void CalEraInfo_should_be_callable_indirectly_against_only_specified_instance()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var calendar = new JapaneseLunisolarCalendar();

                var calendarProxy = new PProxyJapaneseLunisolarCalendar();
                var japaneseLunisolarCalendar_get_CalEraInfo = default(MethodInfo);
                var expected = default(Array);
                MakeCalEraInfoTestData(out japaneseLunisolarCalendar_get_CalEraInfo, out expected);
                calendarProxy.CalEraInfoGet().Body = args => expected;
                var calendar_sut = (JapaneseLunisolarCalendar)calendarProxy;


                // Act
                var actual = japaneseLunisolarCalendar_get_CalEraInfo.Invoke(calendar_sut, null) as IEnumerable;


                // Assert
                CollectionAssert.AreEqual(expected, actual);
                CollectionAssert.AreNotEqual(japaneseLunisolarCalendar_get_CalEraInfo.Invoke(calendar, null) as IEnumerable, actual);
            }
        }