예제 #1
0
        public void TestInitialize()
        {
            _mockRepository = new Mock <IGigRepository>();

            var mockUoW = new Mock <IUnitOfWork>();

            mockUoW.SetupGet(u => u.Gigs).Returns(_mockRepository.Object);

            _controller = new GigsController(mockUoW.Object);
            _controller.MockCurrentUser(userId, "*****@*****.**");
        }
예제 #2
0
        //LD THE CONTROLLER OF THE TEST CLASS IS USEFUL TO INITIALIZE THE
        // CONTROLLER AND THE USER THAT I WANT TEST
        public GigsControllerTests()
        {
            _mockRepository = new Mock <IGigRepository>();

            //LD MOCK of "IUnitOfWork"
            var mockUoW = new Mock <IUnitOfWork>();

            //LD MOCK of a specific repository in unitOfWork
            mockUoW.SetupGet(u => u.Gigs).Returns(_mockRepository.Object);

            //LD mock of the specific controller
            _controller = new GigsController(mockUoW.Object);
            _userId     = "1";
            //LD we will assign the user to the controller into the method "MockCurrentUser".
            _controller.MockCurrentUser(_userId, "*****@*****.**");
        }