public void FromText(string original, string text, string tag) { var created = HashTagData.FromText(original); Assert.AreEqual(tag, created.Tag); Assert.AreEqual(text, created.Text); }
public void GenerateExpectedBehavior() { var instance = new SmartCaption("Message Conto #love", new[] { HashTagData.FromTag("#love") }); instance.AddTag(HashTagData.FromText("Love")); Assert.AreEqual("Message Conto #love", instance.Generate()); instance.AddTag(HashTagData.FromText("Lovex")); Assert.AreEqual("Message Conto #love #lovex", instance.Generate()); }
public async Task GetSmart() { call.Setup(item => item.Get(It.IsAny <string>(), It.IsAny <Func <string, Task <SmartResults> > >(), It.IsAny <Func <string, string> >())) .Returns(Task.FromResult(new SmartResults { Results = new List <SmartHashtagResult>( new[] { new SmartHashtagResult { Tag = "Test" } }) })); var result = await instance.Get(HashTagData.FromText("london")).ConfigureAwait(false); Assert.AreEqual(1, result.Length); }
public async Task <HashTagData[]> Get(HashTagData tag) { logger.LogDebug("Get Web Tags: {0}", tag); var result = await cached .Get(tag.Text, arg => client.GetRequest <SmartResults>(arg, CancellationToken.None), arg => arg) .ConfigureAwait(false); return(result.Results.Select( item => { var tagItem = HashTagData.FromText(item.Tag); tagItem.Rank = item.Rank; tagItem.Relevance = item.Relevance; tagItem.MediaCount = item.MediaCount; return tagItem; }).ToArray()); }
public void FromTextArgumnets() { Assert.Throws <ArgumentNullException>(() => HashTagData.FromText(null)); Assert.Throws <ArgumentOutOfRangeException>(() => HashTagData.FromText("#text")); }
public async Task GetSmart() { var result = await instance.Get(HashTagData.FromText("london")).ConfigureAwait(false); Assert.Greater(result.Length, 20); }