public void Identify_Value_That_Is_A_List(string input)
        {
            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            bool actual = sv.IsValueList;

            Assert.IsTrue(actual, input);
        }
        public void Parse_Invalid_Boolean_Fails()
        {
            string input = "perhaps";

            VCardSimpleValue vs = new VCardSimpleValue(Name, input);
            vs.GetBoolean();
        }
        public void Parse_Integer(string input, int expected)
        {
            VCardSimpleValue vs = new VCardSimpleValue(Name, input);
            int actual = vs.GetInteger();

            Assert.AreEqual(expected, actual);
        }
        public void Fail_To_Identify_Value_With_Escape_At_Ending()
        {
            const string input = @"Hello\";

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);

            bool actual = sv.IsValueList;
        }
        public void Parse_Boolean_True(string input)
        {
            const bool expected = true;

            VCardSimpleValue vs = new VCardSimpleValue(Name, input);
            bool actual = vs.GetBoolean();

            Assert.AreEqual(expected, actual);
        }
        public void Escaped_Separators_Should_Not_Separate_Values()
        {
            const string input = @"Hello\,There";
            string[] expected = new[] { @"Hello\,There" };

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            var actual = sv.GetListValues();

            AssertEncodedValueList(expected, actual);
        }
        public void A_Null_String_Should_Return_A_Single_Value()
        {
            const string input = null;
            string[] expected = new [] { "" };

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            var actual = sv.GetListValues();

            AssertEncodedValueList(expected, actual);
        }
        public void DateTime_With_Fraction_Of_Second_And_Separators_Local()
        {
            const string input = "2010-11-14T22:27:54.123";
            DateTime expected = new DateTime(2010, 11, 14, 22, 27, 54, DateTimeKind.Unspecified);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void DateTime_With_Fraction_Of_Second_Utc()
        {
            const string input = "20101114T222754123Z";
            DateTime expected = new DateTime(2010, 11, 14, 22, 27, 54, DateTimeKind.Utc);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void DateTime_Hours_Minutes_Utc()
        {
            const string input = "20101114T2227Z";
            DateTime expected = new DateTime(2010, 11, 14, 22, 27, 00, DateTimeKind.Utc);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Change_IsValueList_When_EscapedValue_Changes()
        {
            VCardSimpleValue sv = new VCardSimpleValue(Name, "One");
            Assert.IsFalse(sv.IsValueList, "1");

            sv.EscapedValue = "Two,Three,Four";
            Assert.IsTrue(sv.IsValueList, "2");

            sv.EscapedValue = "Five";
            Assert.IsFalse(sv.IsValueList, "3");
        }
        public void Outlook_Utc_DateTime()
        {
            const string input = "20101114T222754Z";
            DateTime expected = new DateTime(2010, 11, 14, 22, 27, 54, DateTimeKind.Utc);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Rfc2445_UTC_Example_6()
        {
            const string input = "19970714T173000Z";
            DateTime expected = new DateTime(1997, 07, 14, 17, 30, 00, DateTimeKind.Utc);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Rfc2445_UTC_Example_3()
        {
            const string input = "19980119T070000Z";
            DateTime expected = new DateTime(1998, 01, 19, 07, 00, 00, DateTimeKind.Utc);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Rfc2445_Local_Example_5()
        {
            const string input = "19970714T133000";
            DateTime expected = new DateTime(1997, 07, 14, 13, 30, 00, DateTimeKind.Unspecified);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Rfc2445_Local_Example_2()
        {
            const string input = "19980118T230000";
            DateTime expected = new DateTime(1998, 01, 18, 23, 00, 00, DateTimeKind.Unspecified);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Rfc2445_Invalid_Example_1()
        {
            const string input = "19980119T230000-0800";

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            sv.GetDateTime();
        }
        public void Rfc2425_Example_4_Multiple_Values()
        {
            const string input = "1996-10-22T14:00:00Z,1996-08-11T12:34:56Z";
            DateTime[] expected = new DateTime[] {
                new DateTime(1996, 10, 22, 14, 00, 00, DateTimeKind.Utc),
                new DateTime(1996, 08, 11, 12, 34, 56, DateTimeKind.Utc),
            };

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);

            var actual = sv.GetListValues();

            Assert.AreEqual(expected.GetLength(0), actual.Count, "Number of items");
            DateTimeAssert.AreEqual(expected[0], actual[0].GetDateTime());
            DateTimeAssert.AreEqual(expected[1], actual[1].GetDateTime());
        }
        public void No_Separators_Should_Return_A_Single_Value()
        {
            const string input = @"Hello There";
            string[] expected = new[] { "Hello There" };

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            var actual = sv.GetListValues();

            AssertEncodedValueList(expected, actual);
        }
        public void Separators_At_Beginning_And_End_Should_Result_In_Empty_Items()
        {
            const string input = @",Hello,There,";
            string[] expected = new[] { "", "Hello", "There", "" };

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            var actual = sv.GetListValues();

            AssertEncodedValueList(expected, actual);
        }
        public void The_Name_Of_Each_Returned_Value_Should_Be_The_Index_Starting_With_1()
        {
            const string input = @"Hello,There,Bob";
            string[] expected = new[] { "1", "2", "3" };

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            var actual = sv.GetListValues();

            CollectionAssert.AreEqual(expected, from a in actual select a.Name);
        }
        public void List_Separator_Causes_Exception()
        {
            const string input = "19961022T140000Z,19960811T123456Z";

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            sv.GetDateTime();
        }
        public void Incomplete_Date_Fails()
        {
            const string input = "1998010";

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            sv.GetDateTime();
        }
        public void DateTime_With_Time_Marker_But_No_Time_Fails()
        {
            const string input = "20101114T";

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            sv.GetDateTime();
        }
        public void DateTime_With_Letters_In_Date_Fails()
        {
            const string input = "201A1114T222754Z";

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            sv.GetDateTime();
        }
        public void Rfc2425_DateTime_Example_1_With_Dashes()
        {
            const string input = "1996-10-22T14:00:00Z";
            DateTime expected = new DateTime(1996, 10, 22, 14, 00, 00, DateTimeKind.Utc);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Rfc2425_DateTime_Example_3()
        {
            const string input = "19960811T123456Z";
            DateTime expected = new DateTime(1996, 08, 11, 12, 34, 56, DateTimeKind.Utc);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Rfc2425_Date_Example_3()
        {
            const string input = "19850412";
            DateTime expected = new DateTime(1985, 04, 12, 00, 00, 00, DateTimeKind.Unspecified);

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            DateTime actual = sv.GetDateTime();

            DateTimeAssert.AreEqual(expected, actual);
        }
        public void Parse_Invalid_Integer_Fails(string input)
        {
            VCardSimpleValue vs = new VCardSimpleValue(Name, input);

            vs.GetInteger();
        }
        public void List_With_Two_Items()
        {
            const string input = @"Hello,There";
            string[] expected = new[] { "Hello", "There" };

            VCardSimpleValue sv = new VCardSimpleValue(Name, input);
            var actual = sv.GetListValues();

            AssertEncodedValueList(expected, actual);
        }