Beispiel #1
0
        public async Task Delete_ShouldThrowArgumentNullException_WhenIdIsInvalid(string id)
        {
            Mock <ILogger <TokenUserData> > mockLogger = new Mock <ILogger <TokenUserData> >();
            Mock <ITokenUserRepository>     mockTokenUserRepository = new Mock <ITokenUserRepository>();

            mockTokenUserRepository.Setup(x => x.Delete(It.IsAny <string>())).Returns(Task.FromResult(true));

            TokenUserData sut = new TokenUserData(mockLogger.Object, mockTokenUserRepository.Object);

            await Assert.ThrowsAsync <ArgumentNullException>(() => sut.Delete(id));
        }
Beispiel #2
0
        public async Task Delete_ShouldReturn_WhenIdIsValid()
        {
            Mock <ILogger <TokenUserData> > mockLogger = new Mock <ILogger <TokenUserData> >();
            Mock <ITokenUserRepository>     mockTokenUserRepository = new Mock <ITokenUserRepository>();

            mockTokenUserRepository.Setup(x => x.Delete(It.IsAny <string>())).Returns(Task.FromResult(true));

            TokenUserData sut = new TokenUserData(mockLogger.Object, mockTokenUserRepository.Object);

            await sut.Delete("TestId");

            mockTokenUserRepository.Verify(x => x.Delete("TestId"), Times.Once());
        }