예제 #1
0
        public void Adds_Simple_Strings()
        {
            string filePath, value1, value2;

            using (var sut = new iOSResxConverterOutput(_folder.FullName, ""))
            {
                filePath = sut.OutputFilePath;
                value1   = _fixture.Create <string>();
                value2   = _fixture.Create <string>();

                sut.WriteString(new Core.ResxString {
                    Key = "myString1", Value = value1
                });
                sut.WriteString(new Core.ResxString {
                    Key = "superString", Value = value2
                });
            }

            var strings = File.ReadAllLines(filePath);

            Assert.Equal(2, strings.Length);
            var s = strings[0];

            Assert.Equal($"\"my_string1\" = \"{value1}\";", s);
            s = strings[1];
            Assert.Equal($"\"super_string\" = \"{value2}\";", s);
        }
예제 #2
0
        public void Escapes_Strings()
        {
            string filePath, value = "\" text \\ text \n"; // In XML, only \n is used

            using (var sut = new iOSResxConverterOutput(_folder.FullName, ""))
            {
                filePath = sut.OutputFilePath;
                sut.WriteString(new Core.ResxString {
                    Key = "str", Value = value
                });
            }

            var strings = File.ReadAllLines(filePath);

            Assert.Equal(1, strings.Length);
            var s = strings[0];

            Assert.Equal("\"str\" = \"\\\" text \\\\ text \\n\";", s);
        }