Ejemplo n.º 1
0
        public UserServiceTests()
        {
            // Definindo quais serão as classes mockadas
            userServiceMock      = new Mock <IUserService>();
            signManagerMock      = new Mock <IApplicationSignInManager>();
            unitOfWorkMock       = new Mock <IUnitOfWork>();
            userRepositoryMock   = new Mock <IUserRepository>();
            bookRepositoryMock   = new Mock <IBookRepository>();
            userEmailServiceMock = new Mock <IUserEmailService>();
            mapperMock           = new Mock <IMapper>();

            //Simula login do usuario
            Thread.CurrentPrincipal = new UserMock().GetClaimsUser();

            userRepositoryMock.Setup(repo => repo.Insert(It.IsAny <User>())).Returns(() =>
            {
                return(UserMock.GetGrantee());
            });

            userRepositoryMock.Setup(repo => repo.Update(It.IsAny <User>())).Returns(() =>
            {
                return(UserMock.GetGrantee());
            });

            userRepositoryMock.Setup(repo => repo.Find(It.IsAny <Expression <Func <User, bool> > >())).Returns(() =>
            {
                return(UserMock.GetGrantee());
            });

            userRepositoryMock.Setup(repo => repo.Find(It.IsAny <IncludeList <User> >(), It.IsAny <Guid>())).Returns(() =>
            {
                return(UserMock.GetGrantee());
            });

            userRepositoryMock.Setup(repo => repo.Get()).Returns(() =>
            {
                return(new List <User>()
                {
                    UserMock.GetGrantee(),
                    UserMock.GetDonor()
                }.AsQueryable());
            });

            userServiceMock.Setup(service => service.Insert(It.IsAny <User>())).Verifiable();
        }
Ejemplo n.º 2
0
        public EmailTemplateTests()
        {
            emailTemplate = new EmailTemplate();

            user = UserMock.GetDonor();

            requestingUser = UserMock.GetGrantee();

            administrator = UserMock.GetAdmin();


            contactUs = new ContactUs()
            {
                Name    = "Rafael Rocha",
                Email   = "*****@*****.**",
                Message = "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident",
                Phone   = "(11) 954422-2765"
            };
        }