Example #1
0
        public async Task Delete_ShouldThrowArgumentNullException_WhenInputIsNull(string id)
        {
            Mock <IDynamoDBContext> mock = new Mock <IDynamoDBContext>();
            ITokenUserRepository    sut  = new TokenUserRepository(mock.Object);

            await Assert.ThrowsAsync <ArgumentNullException>(() => sut.Delete(id));
        }
Example #2
0
        public async Task Delete_ShouldComplete_WhenInputIsValid()
        {
            string id = "abc123";

            Mock <IDynamoDBContext> mock = new Mock <IDynamoDBContext>();

            mock.Setup(x => x.DeleteAsync <TokenUser>(It.IsAny <string>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(true));

            ITokenUserRepository repository = new TokenUserRepository(mock.Object);
            await repository.Delete(id);

            mock.Verify(x => x.DeleteAsync <TokenUser>(It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Once());
        }