public async Task GetOriginalUrl_InvalidHashInput_ReturnNull(string inputHash) { var sut = new ShortLinkService(_configurationMock, _dataProviderMock.Object, _hashidsMock.Object); var result = await sut.GetOriginalUrl(inputHash).ConfigureAwait(false); Assert.Null(result); }
public async Task GetOriginalUrl_DecoderReturnsNull_ReturnNull() { _hashidsMock.Setup(x => x.Decode("FDHFHH")).Returns((int[])null); var sut = new ShortLinkService(_configurationMock, _dataProviderMock.Object, _hashidsMock.Object); var result = await sut.GetOriginalUrl("FDHFHH").ConfigureAwait(false); Assert.Null(result); }
public async Task GetOriginalUrl_DecoderReturnsUrlIds_ReturnOriginalUrlOfTheFirstUrlId() { _hashidsMock.Setup(x => x.Decode("FDHFHH")).Returns(new int[] { 1, 2, 3 }); _dataProviderMock.Setup(x => x.GetOriginalUrl(1)).ReturnsAsync("https://dummy.com"); var sut = new ShortLinkService(_configurationMock, _dataProviderMock.Object, _hashidsMock.Object); var result = await sut.GetOriginalUrl("FDHFHH").ConfigureAwait(false); Assert.Equal("https://dummy.com", result); }