示例#1
0
        public async Task FindLinkBundleWithMatchingVanityUrl()
        {
            // Arrange
            for (var i = 1; i <= 100; i++)
            {
                _sourceList.Add(new LinkBundle
                {
                    Id          = Guid.NewGuid().ToString(),
                    Description = $"Link Bundle {i}",
                    VanityUrl   = $"link-bundle-{i}"
                });
            }

            var random    = new Random(DateTime.UtcNow.Millisecond);
            var index     = random.Next(0, 99);
            var vanityUrl = _sourceList[index].VanityUrl;

            // Act
            var match = await _linksService.FindLinkBundleAsync(vanityUrl);

            // Assert
            Assert.NotNull(match);
            Assert.Equal(vanityUrl, match.VanityUrl);
        }