예제 #1
0
        public void Save_WithNullEntity_ThrowsArgumentNullException(Mock<IUnitOfWork> unitOfWork, Mock<IRepository> repository)
        {
            // Given
            var sut = new CommandService<object>(unitOfWork.Object, repository.Object);

            // When, Then
            Assert.Throws(typeof(ArgumentNullException), () => sut.Save(null));
        }
예제 #2
0
        public void Save_WithEntity_DelegatesToRepository(
            Mock<IUnitOfWork> unitOfWork,
            Mock<IRepository> repository,
            object entity)
        {
            // Given
            var sut = new CommandService<object>(unitOfWork.Object, repository.Object);

            // When
            sut.Save(entity);

            // Then
            repository.Verify(m => m.Save(entity));
        }