Exemple #1
0
        public void Call_LoggedInUser_GetUserId_Once()
        {
            // Arrange
            var domainService    = new Mock <IDomainService>();
            var userService      = new Mock <IUserService>();
            var loggedInUser     = new Mock <ILoggedInUser>();
            var sellerController = new SellerController(userService.Object, domainService.Object, loggedInUser.Object);

            var userId = "userId";

            loggedInUser.Setup(l => l.GetUserId()).Returns(userId);

            var domains = new List <Domain>()
            {
                new Domain()
                {
                    Name = "name"
                }
            };

            domainService.Setup(d => d.GetSellerRejectedDomainsByUserId(userId)).Returns(domains.AsQueryable <Domain>());

            // Act
            sellerController.Rejected();

            // Assert
            loggedInUser.Verify(l => l.GetUserId(), Times.Once());
        }