Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void Creates_Correct_File_For_Culture()
        {
            var expectedPath = Path.Combine(_folder.FullName, "pt-PT.lproj", "Localizable.strings");

            using (var sut = new iOSResxConverterOutput(_folder.FullName, "pt-PT"))
            {
                Assert.Equal(expectedPath, sut.OutputFilePath);
            }

            Assert.True(File.Exists(expectedPath));
        }
Ejemplo n.º 3
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);
        }