I expect ToString("MM/dd/yyyy") to ignore the system settings and always output the format as defined. The below test passes if I set my Windows 10 date string set to the 08/27/2020 format but fails if I set it to 2020-08-27 format with the below error.
Am I missing something?
[Test]
public void TestDate() {
Assert.AreEqual("08/08/2020", (new DateTime(2020, 8, 8)).ToString("MM/dd/yyyy"));
}
Results
String lengths are both 10. Strings differ at index 2.
Expected: "08/08/2020"
But was: "08-08-2020"