Skip to content

Inutile model validation error message #25

Closed
@AlexArchive

Description

@AlexArchive
[Test]
public void Post_ReturnsCorrectModel()
{
    const string Slug = "abc";
    repository
       .Setup(repo => repo.Find(Slug))
       .Returns(PostsMother.CreatePost(withSlug: Slug));

    controller
        .WithCallTo(c => c.Post(Slug))
        .ShouldRenderDefaultView()
        .WithModel<Post>(actual => actual.Slug == "something random");
}

The aforementioned code produces the following error message -

Expected view model to pass the given condition, but it failed.

In practice I found this error message to be completely unhelpful. Instead I suggest something along the lines of -

Expected "abc" but instead was "something random".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions