Esempio n. 1
0
        public void IntegrationTest()
        {
            IPropertiesFile file = new InMemoryPropertiesFile(new List <PropertyPair>
            {
                new PropertyPair {
                    Key = "Key1", Value = "Value1"
                },
                new PropertyPair {
                    Key = "#", Value = ""
                },
                new PropertyPair {
                    Key = "#", Value = " A TAB-LIKE COMMENT"
                },
                new PropertyPair {
                    Key = "#", Value = ""
                },
                new PropertyPair {
                    Key = "", Value = ""
                },
                new PropertyPair {
                    Key = "!", Value = "key = value"
                },
                new PropertyPair {
                    Key = "Key2", Value = "Value2"
                }
            });
            ICommand cmd = new StripCommentsCommand(file);

            cmd.Execute();

            Assert.Equal(3, file.GetProperties().Count());
            Assert.Equal("Key1", file.GetProperties().First().Key);
            Assert.Equal("Key2", file.GetProperties().Last().Key);
        }
Esempio n. 2
0
        public void EmptyFile_ShouldDoNothing()
        {
            IPropertiesFile file = new InMemoryPropertiesFile();
            ICommand        cmd  = new StripCommentsCommand(file);

            cmd.Execute();

            Assert.Empty(file.GetProperties());
        }
Esempio n. 3
0
        public void FileWithComment_ShouldRemoveComment(string commentKey)
        {
            IPropertiesFile file = new InMemoryPropertiesFile(new List <PropertyPair>
            {
                new PropertyPair {
                    Key = commentKey, Value = "Hello, I am a comment."
                }
            });
            ICommand cmd = new StripCommentsCommand(file);

            cmd.Execute();

            Assert.Empty(file.GetProperties());
        }
Esempio n. 4
0
        public void FileWithoutComments_ShouldDoNothing()
        {
            IPropertiesFile file = new InMemoryPropertiesFile(new List <PropertyPair>
            {
                new PropertyPair {
                    Key = "Key1", Value = "Value1"
                },
                new PropertyPair {
                    Key = "", Value = ""
                },
                new PropertyPair {
                    Key = "Key2", Value = "Value2"
                }
            });
            ICommand cmd = new StripCommentsCommand(file);

            cmd.Execute();

            Assert.Equal(3, file.GetProperties().Count());
        }
Esempio n. 5
0
        public void NullFile_ShouldDoNothing()
        {
            ICommand cmd = new StripCommentsCommand(null);

            cmd.Execute();
        }