public void Add() { string tag1 = GetRandomString(); PostTests.AddTestPost(tag1); string tag2 = GetRandomString(); PostTests.AddTestPost(tag2); string bundleName = AddTestBundle(tag1 + " " + tag2); // it regularly take a couple of seconds for the added bundle to show up through the api bool found = false; System.Threading.Thread.Sleep(2000); List <Bundle> bundles = Bundle.Get(); foreach (Bundle b in bundles) { if (b.Name == bundleName) { found = true; break; } } Assert.IsTrue(found, "The Bundle '" + bundleName + "' does not seem to have been sucessfully added."); }
public void Delete() { string tag = GetRandomString(); string url = PostTests.AddTestPost(tag); Assert.IsTrue(url.Length > 0, "The url '" + url + "' was not sucessfully added."); string bundleName = AddTestBundle(tag); Bundle.Delete(bundleName); CleanupBundleList.Remove(bundleName); bool found = false; // it regularly take a couple of seconds for the deleted bundle to show as deleted through the api System.Threading.Thread.Sleep(2000); List <Bundle> bundles = Bundle.Get(); foreach (Bundle b in bundles) { if (b.Name == bundleName) { found = true; break; } } Assert.IsTrue(!found, "The Bundle '" + bundleName + "' was not sucessfully deleted"); }
public void Rename() { string tag = GetRandomString(); string newTag = GetRandomString(); string url = PostTests.AddTestPost(tag); Post p = Post.GetPost(url); Assert.IsTrue(p.Tag == tag, "The post was not sucessfully created with the tag"); Tag.Rename(tag, newTag); p = Post.GetPost(url); Assert.IsTrue(p.Tag == newTag, "The tag was NOT sucessfully renamed"); }
public void Get() { string tag1 = GetRandomString() + "#?%&"; PostTests.AddTestPost(tag1); string tag2 = GetRandomString(); PostTests.AddTestPost(tag2); string bundleName = AddTestBundle(tag1 + " " + tag2); bool found = false; bool tag1InBundle = false; bool tag2InBundle = false; List <Bundle> bundles = Bundle.Get(); foreach (Bundle b in bundles) { if (b.Name == bundleName) { found = true; string[] tags = b.Tags.Split(' '); foreach (string tag in tags) { if (tag == tag1) { tag1InBundle = true; } else if (tag == tag2) { tag2InBundle = true; } } break; } } Assert.IsTrue(found, "The Bundle '" + bundleName + "' was not sucessfully returned"); Assert.IsTrue(tag1InBundle, "Tag1 '" + tag1 + "' was not returned in Bundle.Tag"); Assert.IsTrue(tag2InBundle, "Tag2 '" + tag2 + "' was not returned in Bundle.Tag"); }
public void Get() { string tag = GetRandomString(); PostTests.AddTestPost(tag); List <Tag> tags = Tag.Get(); bool found = false; foreach (Tag t in tags) { if (t.Name == tag) { found = true; break; } } Assert.IsTrue(found, "The tag '" + tag + "' was not sucessfully returned."); }