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

            //Act && Assert
            Assert.Throws <ArgumentNullException>(() => projectService.Create(null, userId));
        }
Beispiel #2
0
        public void ThrowArgumentException_WhenUserIdIEmpty()
        {
            //Arrange
            var projectsRepoMock     = new Mock <IEfRepository <Project> >();
            var projectStarsRepoMock = new Mock <IEfRepository <ProjectStar> >();
            var projectService       = new Services.ProjectService(projectsRepoMock.Object, projectStarsRepoMock.Object);
            var projectDto           = new Mock <ProjectDto>();

            //Act && Assert
            Assert.Throws <ArgumentException>(() => projectService.Create(projectDto.Object, string.Empty));
        }
Beispiel #3
0
        public void CallProjectRepoAddOnce_WhenIdIsValid()
        {
            //Arrange
            var projectsRepoMock     = new Mock <IEfRepository <Project> >();
            var projectStarsRepoMock = new Mock <IEfRepository <ProjectStar> >();
            var projectService       = new Services.ProjectService(projectsRepoMock.Object, projectStarsRepoMock.Object);
            var userId     = Guid.NewGuid().ToString();
            var projectDto = new Mock <ProjectDto>();

            //Act
            projectService.Create(projectDto.Object, userId);

            //Assert
            projectsRepoMock.Verify(m => m.Add(It.IsAny <Project>()), Times.Once);
        }