public void TestRetrieveEntityProperties() { WPPerson wpPerson = GetRandomWPPerson(); Backendless.Persistence.Save(wpPerson); List <ObjectProperty> properties = Backendless.Persistence.Describe(typeof(WPPerson).Name); Assert.IsNotNull(properties, "Server returned null"); Assert.AreEqual(properties.Count, 6, "Server returned unexpected amount of properties"); foreach (ObjectProperty property in properties) { if (property.Name.Equals("Age")) { Assert.AreEqual(DateTypeEnum.INT, property.Type, "Property was of unexpected type"); Assert.IsFalse(property.IsRequired, "Property had a wrong required value"); } else if (property.Name.Equals("Name")) { Assert.AreEqual(DateTypeEnum.STRING, property.Type, "Property was of unexpected type"); Assert.IsFalse(property.IsRequired, "Property had a wrong required value"); } else if (property.Name.Equals("created")) { Assert.AreEqual(DateTypeEnum.DATETIME, property.Type, "Property was of unexpected type"); Assert.IsFalse(property.IsRequired, "Property had a wrong required value"); } else if (property.Name.Equals("objectId")) { Assert.AreEqual(DateTypeEnum.STRING_ID, property.Type, "Property was of unexpected type"); Assert.IsFalse(property.IsRequired, "Property had a wrong required value"); } else if (property.Name.Equals("updated")) { Assert.AreEqual(DateTypeEnum.DATETIME, property.Type, "Property was of unexpected type"); Assert.IsFalse(property.IsRequired, "Property had a wrong required value"); } else if (property.Name.Equals("ownerId")) { Assert.AreEqual(DateTypeEnum.STRING, property.Type, "Property was of unexpected type"); Assert.IsFalse(property.IsRequired, "Property had a wrong required value"); } else { Assert.Fail("Got unexpected property: " + property.Name); } } }
public void TestDeleteObjectWithWrongId() { WPPerson wpPerson = GetRandomWPPerson(); Backendless.Persistence.Save(wpPerson); wpPerson.ObjectId = "foobar"; try { Backendless.Persistence.Of <WPPerson>().Remove(wpPerson); Assert.Fail("Server didn't throw an exception"); } catch (System.Exception e) { CheckErrorCode(1033, e); } }
public void TestMessagePublishPOJOValue() { SetLatch(); var wpPerson = new WPPerson { Age = 22, Name = "Vasya" }; SetMessage(wpPerson); subscription = Backendless.Messaging.Subscribe(TEST_CHANNEL, new PublishSubscription()); messageStatus = Backendless.Messaging.Publish(message, TEST_CHANNEL); Assert.IsNotNull(messageStatus.MessageId, "Server didn't set a messageId for the message"); Assert.IsTrue(messageStatus.Status.Equals(PublishStatusEnum.PUBLISHED), "Message status was not set as published"); Await(); CheckResult(); }
public void TestMessagePublishArrayOfPOJOValue() { SetLatch(); var person123451 = new WPPerson { Age = 22, Name = "Vasya" }; var androidPerson123452 = new WPPerson { Age = 35, Name = "Petya" }; SetMessage(new[] { person123451, androidPerson123452 }); channel = Backendless.Messaging.Subscribe(TEST_CHANNEL); messageStatus = Backendless.Messaging.Publish(message, TEST_CHANNEL); Assert.IsNotNull(messageStatus.MessageId, "Server didn't set a messageId for the message"); Assert.IsTrue(messageStatus.Status.Equals(PublishStatusEnum.PUBLISHED), "Message status was not set as published"); Await(); CheckResult(); }