예제 #1
0
        public async Task Orchestrate_Cread_And_Read_Of_Persons_With_Postman()
        {
            var getRequest  = folder.FindRaw("GetAllPersons", variables);
            var getResponse = await api.SendAsync(getRequest.ToHttpRequestMessage());

            getResponse.StatusCode.Should().Be(StatusCodes.Status200OK, "this should work ;)");
            var getResponseContent = await getResponse.Content.ReadAsStringAsync();

            getResponseContent.Should().Be("[]", "in the beginning, there are no persons");


            var createArthurRequest = folder.FindRaw("PostPerson", variables.Enrich(new {
                firstName = "Arthur",
                surname   = "Dent"
            }));
            var createArthurResponse = await api.SendAsync(createArthurRequest.ToHttpRequestMessage());

            createArthurResponse.StatusCode.Should().Be(StatusCodes.Status200OK, "Arthur needs to be on the bridge!");

            var createZaphodRequest = folder.FindRaw("PostPerson", variables.Enrich(new {
                firstName = "Zaphod",
                surname   = "Beeblebrox"
            }));
            var createZaphodResponse = await api.SendAsync(createZaphodRequest.ToHttpRequestMessage());

            createZaphodResponse.StatusCode.Should().Be(StatusCodes.Status200OK, "we need Zaphods heads - all of them!");

            var persons = await client.PersonAllAsync();

            persons.Should().BeEquivalentTo(new Person[]
            {
                new() { FirstName = "Arthur", Surname = "Dent" },
                new() { FirstName = "Zaphod", Surname = "Beeblebrox" }
            },