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); }
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 "); }