PSHostsFileTest.AssertFile.MatchesIgnoringNewlines C# (CSharp) Method

MatchesIgnoringNewlines() public static method

public static MatchesIgnoringNewlines ( string hostsFile, string expectedString ) : void
hostsFile string
expectedString string
return void
        public static void MatchesIgnoringNewlines(string hostsFile, string expectedString)
        {
            string a = File.ReadAllText(hostsFile);
            string b = expectedString;
            a = a.Replace("\r\n", "\n");
            b = b.Replace("\r\n", "\n");
            PAssert.IsTrue(() => a == b);
        }

Usage Example

Esempio n. 1
0
        public void can_remove_an_entry()
        {
            string filename = GetFileWithContents(@"
127.0.0.1           localhost
10.90.82.100        somehost

", Encoding.UTF8);

            var sut = new Remove();

            sut.RemoveFromFile("somehost", filename);

            AssertFile.MatchesIgnoringNewlines(filename, @"
127.0.0.1           localhost

");
        }
All Usage Examples Of PSHostsFileTest.AssertFile::MatchesIgnoringNewlines