예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnSameInstanceInSameThread()
        public virtual void ShouldReturnSameInstanceInSameThread()
        {
            // given
            RFC1123 instance = RFC1123.Instance();

            // when
            RFC1123 instance2 = RFC1123.Instance();

            // then
            assertSame("Expected to get same instance from second call to RFC1123.instance() in same thread", instance, instance2);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFormatRFC1123() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFormatRFC1123()
        {
            // given
            string input = "Mon, 15 Aug 2005 15:52:01 +0000";

            // when
            string output = RFC1123.FormatDate(RFC1123.ParseTimestamp(input));

            // then
            assertEquals(input, output);
        }
예제 #3
0
        internal static RFC1123 Instance()
        {
            RFC1123 instance = _instances.get();

            if (null == instance)
            {
                instance = new RFC1123();
                _instances.set(instance);
            }
            return(instance);
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldParseRFC1123() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldParseRFC1123()
        {
            // given
            string input = "Mon, 15 Aug 2005 15:52:01 +0000";

            // when
            DateTime result = RFC1123.ParseTimestamp(input);

            // then
            _calendar = new DateTime(result);
            assertEquals(DayOfWeek.Monday, _calendar.DayOfWeek);
            assertEquals(15, _calendar.Day);
            assertEquals(8, _calendar.Month);
            assertEquals(2005, _calendar.Year);
            assertEquals(15, _calendar.Hour);
            assertEquals(52, _calendar.Minute);
            assertEquals(1, _calendar.Second);
        }