コード例 #1
0
        public async Task <ActionResult <int> > Post([FromHeader(Name = "X-Anonymous-UserTracking")][Required] string headerValue, MessageBoardRequest request)
        {
            request.AnonymousTrackingId = headerValue;
            var response = await _createMessageBoardHandler.ExecuteAsync(request);

            return(GetResult(response));
        }
コード例 #2
0
        public async Task Should_ExecuteAsync_Return_201()
        {
            //ARRANGE
            _fakeDb.Setup(x => x.Insert(It.IsAny <string>(), It.IsAny <Func <List <MessageBoard> > >()));

            //ACT
            var request = new MessageBoardRequest()
            {
                Message = "Test A"
            };

            var response = await _createMessageBoardHandler.ExecuteAsync(request);

            //ASSERT
            Assert.That(response.IsSuccessful);
            Assert.That(response.Value == (int)HttpStatusCode.Created);
        }