コード例 #1
0
 public OrderControllerTests()
 {
     _mapper          = new Mapper(MapperHelpers.GetMapperConfiguration());
     _unitOfWork      = new Mock <IUnitOfWork>();
     _httpContext     = new Mock <HttpContext>();
     _userManagerMock = new Mock <FakeUserManager>();
     _orderController = new OrdersController(
         _unitOfWork.Object,
         _mapper,
         _userManagerMock.Object
         );
 }
コード例 #2
0
        public AdministratorControllerTests()
        {
            _httpContext     = new Mock <HttpContext>();
            _userManagerMock = new Mock <FakeUserManager>();
            _roleManager     = new Mock <FakeRoleManager>();
            _mapper          = new Mapper(MapperHelpers.GetMapperConfiguration());
            _unitOfWork      = new Mock <IUnitOfWork>();

            _administrationController = new AdministrationController(
                _userManagerMock.Object,
                _mapper,
                _unitOfWork.Object,
                _roleManager.Object
                );
        }
コード例 #3
0
        public AuthControllerTests()
        {
            _userManagerMock   = new Mock <FakeUserManager>();
            _signInManagerMock = new Mock <FakeSignInManager>();
            _tokenGenetaror    = new Mock <ITokenGenerator>();
            _httpContext       = new Mock <HttpContext>();
            _tokenGenetaror.Setup(t =>
                                  t.GenerateTokenAsync(It.IsAny <User>(),
                                                       It.IsAny <IConfiguration>(),
                                                       _userManagerMock.Object
                                                       )).ReturnsAsync("asduykasgdyukasfgasdkuy");

            _authController = new AuthController(
                new Mock <IConfiguration>().Object,
                _userManagerMock.Object, _signInManagerMock.Object,
                new Mapper(MapperHelpers.GetMapperConfiguration()),
                _tokenGenetaror.Object
                );
        }
コード例 #4
0
 public void MockData()
 {
     _mock = GetConfiguredMockObject();
     _productController = new ProductsController(_mock.Object, new Mapper(MapperHelpers.GetMapperConfiguration()));
 }
コード例 #5
0
        public async Task DeleteProductAsync_InValidId_ShouldReturnNotFound()
        {
            Mock <IUnitOfWork> mock = GetConfiguredMockObject();
            ProductsController productController = new ProductsController(mock.Object, new Mapper(MapperHelpers.GetMapperConfiguration()));
            var resultFromController             = await productController.DeleteProductAsync(2);

            var result = resultFromController as NotFoundResult;

            //Assert
            result.Should().NotBeNull();
            result.StatusCode.Should().Be(StatusCodes.Status404NotFound);
        }
コード例 #6
0
 public OrderStatusControllerTests()
 {
     _mapper                = new Mapper(MapperHelpers.GetMapperConfiguration());
     _unitOfWork            = new Mock <IUnitOfWork>();
     _orderStatusController = new OrderStatusController(_unitOfWork.Object, _mapper);
 }
コード例 #7
0
 public void MockData()
 {
     _mock = GetConfiguredMockObject();
     _categoryController = new CategoriesController(_mock.Object, new Mapper(MapperHelpers.GetMapperConfiguration()));
 }