示例#1
0
        public void Parse_EmptyText_Equal()
        {
            //Arrange
            var countryParser  = new CountryParser();
            var textFromSource = string.Empty;

            //Act
            countryParser.Parse(textFromSource);

            //Assert => ExpectedException Annotation
        }
示例#2
0
        public void Parse_WhiteSpaceText_Equal()
        {
            //Arrange
            var          countryParser  = new CountryParser();
            const string textFromSource = "  ";

            //Act
            countryParser.Parse(textFromSource);

            //Assert => ExpectedException Annotation
        }
示例#3
0
        public void Parse_JsonLowerCaseText_NotEqual()
        {
            //Arrange
            var          countryParser  = new CountryParser();
            const string textFromSource = "[\r\n  {\r\n    \"name\": \"afghanistan\",\r\n    \"code\": \"AF\"\r\n  },\r\n  {\r\n    \"name\": \"Albania\",\r\n    \"code\": \"AL\"\r\n  },\r\n  {\r\n    \"name\": \"Algeria\",\r\n    \"code\": \"DZ\"\r\n  },\r\n  {\r\n    \"name\": \"American Samoa\",\r\n    \"code\": \"AS\"\r\n  }\r\n]";

            //Act
            var actual = countryParser.Parse(textFromSource);

            //Assert
            var expected = new Dictionary <string, string>
            {
                { "Afghanistan", "AF" },
                { "Albania", "AL" },
                { "Algeria", "DZ" },
                { "American Samoa", "AS" },
            };

            CollectionAssert.AreNotEqual(expected, actual);
        }