public void UserService_Delete_Throws_When_Id_Empty() { CollectionMock .Setup(s => s.DeleteOne(It.IsAny <FilterDefinition <User> >(), CancellationToken.None)) .Returns(new DeleteResult.Acknowledged(1)); var target = CreateTarget(CollectionMock); Assert.Throws <ArgumentException>(() => target.Delete("")); }
public void UserService_Delete_Is_Silent_When_Id_Not_Found() { var expectedId = "filip"; CollectionMock .Setup(s => s.DeleteOne(It.IsAny <FilterDefinition <User> >(), CancellationToken.None)) .Returns(new DeleteResult.Acknowledged(0)); var target = CreateTarget(CollectionMock); Assert.False(target.Delete(expectedId)); CollectionMock.Verify(s => s.DeleteOne(It.IsAny <FilterDefinition <User> >(), CancellationToken.None), Times.Once); }
public void UserService_Delete() { var expectedId = "filip"; CollectionMock .Setup(s => s.DeleteOne(It.IsAny <FilterDefinition <User> >(), CancellationToken.None)) .Returns(new DeleteResult.Acknowledged(1)); var target = CreateTarget(CollectionMock); target.Delete(expectedId); CollectionMock.Verify(s => s.DeleteOne(It.IsAny <FilterDefinition <User> >(), CancellationToken.None), Times.Once); }