public async Task ThrowsExceptionWhenBodyIsNotCorrectFormatAsync()
        {
            // Arrange
            ICustomerManagementService customerManagementService = A.Fake <ICustomerManagementService>();
            ILogger logger      = A.Fake <ILogger>();
            var     sut         = new CustomerManagementFunctions(customerManagementService);
            var     httpContext = new DefaultHttpContext();
            var     httpRequest = new DefaultHttpRequest(httpContext)
            {
                Body = new MemoryStream(Encoding.UTF8.GetBytes("NotCorrectFormat"))
            };

            A.CallTo(() => customerManagementService.StoreCustomerInformationAsync(TestHelper.CustomerId))
            .Returns(TestHelper.GetCustomerInfoWithTestHelperDefaultValues());

            // Act & Assert
            await Assert.ThrowsAsync <JsonReaderException>(() => sut.StoreCustomerAsync(httpRequest));
        }
        public async Task BeGetBadRequestWhenStoreCustomerIsCalledWithoutBodyAsync()
        {
            // Arrange
            ICustomerManagementService customerManagementService = A.Fake <ICustomerManagementService>();
            ILogger logger      = A.Fake <ILogger>();
            var     sut         = new CustomerManagementFunctions(customerManagementService);
            var     httpContext = new DefaultHttpContext();
            var     httpRequest = new DefaultHttpRequest(httpContext);

            A.CallTo(() => customerManagementService.StoreCustomerInformationAsync(TestHelper.CustomerId))
            .Returns(TestHelper.GetCustomerInfoWithTestHelperDefaultValues());

            // Act
            IActionResult actual = await sut.StoreCustomerAsync(httpRequest);

            // Assert
            Assert.Equal(HttpStatusCode.BadRequest, (HttpStatusCode)((StatusCodeResult)actual).StatusCode);
        }
        public async Task GetBadResultWhenCustomerInfoObjectIsNullAsync()
        {
            // Arrange
            ICustomerManagementService customerManagementService = A.Fake <ICustomerManagementService>();
            ILogger logger      = A.Fake <ILogger>();
            var     sut         = new CustomerManagementFunctions(customerManagementService);
            var     httpContext = new DefaultHttpContext();
            var     httpRequest = new DefaultHttpRequest(httpContext)
            {
                Body = new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(TestHelper.GetStoreCustomerWithTestHelperDefaultValues())))
            };

            A.CallTo(() => customerManagementService.StoreCustomerInformationAsync(TestHelper.CustomerId))
            .Returns <CustomerInfo>(null);

            // Act
            IActionResult actual = await sut.StoreCustomerAsync(httpRequest);

            // Assert
            Assert.Equal(HttpStatusCode.BadRequest, (HttpStatusCode)((StatusCodeResult)actual).StatusCode);
        }