dimanche 29 mai 2016

MSTest Assert.AreEqual fails with string array

I'm working up some unit tests and unsure why this particular test is failing.

The test is to assert that a custom view engine looks in the correct place for views.

In my custom view engine is this:

AreaMasterLocationFormats = new[]
        {
            "~/Areas/{2}/App/{1}/Views/{0}.cshtml",
            "~/Areas/{2}/App/Shared/Views/{0}.cshtml"
        };

And in my test is this:

        string[] expected = new[]
        {
            "~/Areas/{2}/App/{1}/Views/{0}.cshtml",
            "~/Areas/{2}/App/Shared/Views/{0}.cshtml"
        };

        CustomRazorViewEngine engine = new CustomRazorViewEngine();

        Assert.AreEqual(expected, engine.AreaMasterLocationFormats);

The test fails with the message:

Message: Assert.AreEqual failed. Expected:<System.String[]>. Actual:<System.String[]>.

(s/o's quote format doesn't like the second lt in that...)

I'm unsure why, as when I debug the test all appears well.

Aucun commentaire:

Enregistrer un commentaire