コード例 #1
0
        public HttpResponseMessage Update(string ticket, Item item)
        {
            var securityProvider = new SecurityProvider(_connectionString);

            var sessionInfo = securityProvider.GetSessionInfo(ticket);

            if (sessionInfo == null)
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized));
            }

            var updateRequest = new UpdateItemRequest
            {
                Item   = item,
                UserId = sessionInfo.User.Id
            };

            var handler = new UpdateItemHandler(_connectionString);

            var response = handler.Handle(updateRequest);

            var httpStatusCode = ResolveStatusCode(response);

            return(Request.CreateResponse(httpStatusCode, response));
        }
        public void ParameterArgumentNullCheck()
        {
            // Arrange
            var sut = new UpdateItemHandler();

            // Act & Assert
            Assert.ThrowsAsync <ArgumentException>(() => sut.ExecuteAsync(null !));
        }
        public void InstantiateConstructor()
        {
            // Act
            var actual = new UpdateItemHandler();

            // Assert
            Assert.NotNull(actual);
        }