Пример #1
0
        public void AddRequest_CorrectlyReturnsOperationname()
        {
            var expected = "sum";
            var request  = new AddRequest();

            var operationName = request.GetOperationName();

            operationName.Should().Be(expected);
        }
Пример #2
0
        public async Task Add_WithTrackingId_TracksOperation()
        {
            var request = new AddRequest
            {
                Addends = new[] { 4, 567, 23 }
            };
            var trackId = "Add_WithTrackingId_TracksOperation";
            var client  = _factory.CreateClient()
                          .WithTrackIdHeader(trackId);

            await client.PostJsonAsync("/calculator/add", request);

            using (new AssertionScope())
            {
                _factory.Journal.TryGetValue(trackId, out var journalOperations)
                .Should().BeTrue();
                journalOperations.Should().ContainSingle()
                .Which.Operation.Should().Be(request.GetOperationName());
            }
        }