コード例 #1
0
ファイル: Delete_Should.cs プロジェクト: danielrss/carmaniacs
        public void ThrowArgumentException_WhenProjectIdIsEmpty()
        {
            //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.Delete(Guid.Empty));
        }
コード例 #2
0
ファイル: Delete_Should.cs プロジェクト: danielrss/carmaniacs
        public void NotCallProjectRepoUpdate_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
            projectService.Delete(projectId);

            //Assert
            projectsRepoMock.Verify(m => m.Update(projectFromRepo), Times.Never);
        }