public async Task TestAddActivityVariablesOldWayNewWay() { var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData <string>("stringint", "42"); newActivity.SetData <string>("stringdouble", "42.2"); newActivity.SetData <string>("stringcomplex", "{ \"test1\": 1, \"test2\": \"testing\" }"); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); Thread.Sleep(AddDelay); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); Assert.AreEqual(42, first.GetData <int>("stringint")); Assert.AreEqual(42.2, first.GetData <double>("stringdouble")); var complex = first.GetData <IDictionary <string, object> >("stringcomplex"); Assert.IsNotNull(complex); }
public async Task TestAddActivityWithString() { int second = 2; double third = 3; var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData("complex", "string"); newActivity.SetData("second", second); newActivity.SetData("third", third); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); Thread.Sleep(AddDelay); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); var complex = first.GetData <String>("complex"); Assert.IsNotNull(complex); Assert.AreEqual("string", complex); }
public async Task TestAddActivityWithDifferentVariables() { int second = 2; double third = 3; var dict = new Dictionary <string, object>(); dict["test1"] = "shawn"; dict["test2"] = "wedge"; dict["test3"] = 42; var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData("complex", dict); newActivity.SetData("second", second); newActivity.SetData("third", third); newActivity.SetData("customc", new CustomClass() { TestString = "string", TestInt = 123, TestDouble = 42.2 }); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); Thread.Sleep(AddDelay); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); var complex = first.GetData <IDictionary <string, object> >("complex"); Assert.IsNotNull(complex); Assert.AreEqual(3, complex.Count); Assert.AreEqual("shawn", complex["test1"]); Assert.AreEqual("wedge", complex["test2"]); Assert.AreEqual(42, complex["test3"]); Assert.AreEqual(2, first.GetData <int>("second")); Assert.AreEqual(3M, first.GetData <double>("third")); var customc = first.GetData <CustomClass>("customc"); Assert.IsNotNull(customc); Assert.AreEqual("string", customc.TestString); Assert.AreEqual(123, customc.TestInt); Assert.AreEqual(42.2, customc.TestDouble); }
public async Task TestAddActivityWithDictionary() { var dict = new Dictionary <String, String>(); dict["test1"] = "shawn"; dict["test2"] = "wedge"; var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData("complex", dict); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); Thread.Sleep(AddDelay); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); var complex = first.GetData <IDictionary <String, String> >("complex"); Assert.IsNotNull(complex); Assert.AreEqual(2, complex.Count); Assert.AreEqual("shawn", complex["test1"]); }
public async Task TestAddActivityWithArray() { var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData("complex", new String[] { "tommaso", "thierry", "shawn" }); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); Thread.Sleep(AddDelay); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); var complex = first.GetData <String[]>("complex"); Assert.IsNotNull(complex); Assert.AreEqual(3, complex.Length); Assert.AreEqual("shawn", complex[2]); }
public async Task TestUpdateActivity() { var newActivity = new Stream.Activity("1", "test", "1") { ForeignId = "post:1", Time = DateTime.UtcNow }; newActivity.SetData <string>("myData", "1"); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); Thread.Sleep(AddDelay); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); first.Actor = "editedActor1"; first.Object = "editedOject1"; first.Verb = "editedVerbTest"; first.SetData <string>("myData", "editedMyData1"); await this._user1.UpdateActivity(first); Thread.Sleep(UpdateDelay); activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var editedFirst = activities.First(); Assert.AreEqual(first.Id, editedFirst.Id); Assert.AreEqual(first.GetData <string>("myData"), editedFirst.GetData <string>("myData")); Assert.AreEqual(first.Actor, editedFirst.Actor); Assert.AreEqual(first.Object, editedFirst.Object); Assert.AreEqual(first.Verb, editedFirst.Verb); }
public async Task TestAddActivityWithArray() { var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData("complex", new String[] { "tommaso", "thierry", "shawn" }); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); var complex = first.GetData<String[]>("complex"); Assert.IsNotNull(complex); Assert.AreEqual(3, complex.Length); Assert.AreEqual("shawn", complex[2]); }
public async Task TestAddActivityWithString() { var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData("complex", "string"); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); var complex = first.GetData<String>("complex"); Assert.IsNotNull(complex); Assert.AreEqual("string", complex); }
public async Task TestAddActivityWithDictionary() { var dict = new Dictionary<String, String>(); dict["test1"] = "shawn"; dict["test2"] = "wedge"; var newActivity = new Stream.Activity("1", "test", "1"); newActivity.SetData("complex", dict); var response = await this._user1.AddActivity(newActivity); Assert.IsNotNull(response); var activities = await this._user1.GetActivities(0, 1); Assert.IsNotNull(activities); Assert.AreEqual(1, activities.Count()); var first = activities.First(); Assert.AreEqual(response.Id, first.Id); var complex = first.GetData<IDictionary<String,String>>("complex"); Assert.IsNotNull(complex); Assert.AreEqual(2, complex.Count); Assert.AreEqual("shawn", complex["test1"]); }