public void FileWithEmptyLines_ShouldBeStrippedOfThem()
        {
            IPropertiesFile file = new InMemoryPropertiesFile(new List <PropertyPair>
            {
                new PropertyPair {
                    Key = "", Value = ""
                },
                new PropertyPair {
                    Key = "", Value = ""
                },
                new PropertyPair {
                    Key = "Key1", Value = "Value1"
                },
                new PropertyPair {
                    Key = "", Value = ""
                },
                new PropertyPair {
                    Key = "#", Value = "Comment 1"
                },
                new PropertyPair {
                    Key = "!", Value = "Comment 2"
                },
                new PropertyPair {
                    Key = "", Value = ""
                }
            });
            ICommand cmd = new StripEmptyLinesCommand(file);

            cmd.Execute();

            Assert.Equal(3, file.GetProperties().Count());
            Assert.Equal("Comment 2", file.GetProperties().Last().Value);
            Assert.Equal("Value1", file.GetProperties().First().Value);
        }
        public void EmptyProperties_ShouldDoNothing()
        {
            IPropertiesFile file = new InMemoryPropertiesFile();
            ICommand        cmd  = new StripEmptyLinesCommand(file);

            cmd.Execute();

            Assert.Empty(file.GetProperties());
        }
        public void OnlyEmptyLines_ShouldRemoveEmptyLines()
        {
            IPropertiesFile file = new InMemoryPropertiesFile(new List <PropertyPair>
            {
                new PropertyPair {
                    Key = "", Value = ""
                },
                new PropertyPair {
                    Key = "", Value = ""
                }
            });
            ICommand cmd = new StripEmptyLinesCommand(file);

            cmd.Execute();

            Assert.Empty(file.GetProperties());
        }
        public void NullFile_ShouldDoNothing()
        {
            ICommand cmd = new StripEmptyLinesCommand(null);

            cmd.Execute();
        }