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

            //Act
            countryParser.Parse(textFromSource);

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

            //Act
            countryParser.Parse(textFromSource);

            //Assert => ExpectedException Annotation
        }
Esempio n. 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);
        }