コード例 #1
0
        public async Task AddAdminUserAsyncTest()
        {
            _mock.Setup(p => p.AddAdminUserAsync(GetTestAdminUserDto())).ReturnsAsync(new int());
            var controller   = new AdminUserController(_mock.Object);
            var actionResult = await controller.AddAdminUserAsync(GetTestAdminUserDto());

            var contentResult = actionResult as OkNegotiatedContentResult <BaseApiResponse>;

            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.IsInstanceOfType(contentResult, typeof(OkNegotiatedContentResult <BaseApiResponse>));
            Assert.IsNotNull(actionResult);
            Assert.IsInstanceOfType(actionResult, typeof(IHttpActionResult));
            Assert.IsInstanceOfType(contentResult.Content.Data, typeof(int));
        }