Skip to content
This repository was archived by the owner on May 19, 2024. It is now read-only.
This repository was archived by the owner on May 19, 2024. It is now read-only.

False positives on body post #75

@bjarmuz

Description

@bjarmuz

Hello,

It seems to work great with testing routes (when you refactor, or change route prefix or global route config it finds the differences and throws errors).

However, I have noticed some weird behaviour.

The test is as follows

 [TestMethod]
    public void TestRoute_ProcessFile()
    {
        string route = "/api/ocr/processfile";
        var request = new OcrRequestMessage(){ProjectId = 303};

        this.httpConfig.ShouldMap(route).WithJsonBody(JsonConvert.SerializeObject(request)).
            To<OcrController>(HttpMethod.Post, x => x.ProcessFile(request));
    }

this is the method:

public async Task<OcrResponseMessage> ProcessFile([FromBody] OcrRequestMessage ocrRequestMessage)
I am able to break it if instead of passing serialized object I pass other string. I am also able to break it if instead of change the route in the project (rename method, remove route from dictionary etc).

I can also break it if I compare the request to a different request object (e.g. I pass a request with Id:1 and then I check the 'ShouldMap' clause to a request with Id:666 and it fails saying that expected 1, but found 666.

However, I wanted to break it by removing the 'FromBody' attribute or by setting it to 'FromUri' - but the test still passes.

Is that an expected behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions