Beispiel #1
0
        public void ThrowArgumentException_WhenUserIdIsEmpty()
        {
            //Arrange
            var projectsRepoMock     = new Mock <IEfRepository <Project> >();
            var projectStarsRepoMock = new Mock <IEfRepository <ProjectStar> >();
            var projectService       = new Services.ProjectService(projectsRepoMock.Object, projectStarsRepoMock.Object);

            //Act && Assert
            Assert.Throws <ArgumentException>(() => projectService.HasUserStarred(Guid.NewGuid(), string.Empty));
        }
Beispiel #2
0
        public void ReturnFalse_WhenProjectIsNonExistent()
        {
            //Arrange
            var     projectsRepoMock     = new Mock <IEfRepository <Project> >();
            var     projectId            = Guid.NewGuid();
            var     projectStarsRepoMock = new Mock <IEfRepository <ProjectStar> >();
            var     projectService       = new Services.ProjectService(projectsRepoMock.Object, projectStarsRepoMock.Object);
            Project projectFromRepo      = null;

            projectsRepoMock.Setup(m => m.GetById(projectId)).Returns(projectFromRepo);

            //Act && Assert
            Assert.IsFalse(projectService.HasUserStarred(projectId, "tootaallyyRandomImageUrl2"));
        }