public void InvalidReceiveMessage_SetProperty()
        {
            GameObject newGameObject = new GameObject("new game object");

            Message setMessage = new Message(newGameObject.Name, MessageAction.Set, "a property name that is wrong or doesn't exist", "a new value", PropType.String);
            Response response = newGameObject.ReceiveMessage(setMessage);
            Assert.IsFalse(response.Status);
            Assert.IsTrue(response.Value == "Property name does not exist");
            Assert.IsTrue(response.PropType == PropType.Error);
        }
        public void InvalidReceiveMessage_GetProperty()
        {
            GameObject newGameObject = new GameObject("new game object");
            Property newProperty = new Property(PropertyType.String, "new property", "a value");
            newGameObject.AddProperty(newProperty);

            Message getMessage = new Message(newGameObject.Name, MessageAction.Get, "wrong name");
            Response response = newGameObject.ReceiveMessage(getMessage);
            Assert.IsFalse(response.Status);
            Assert.IsTrue(response.Value == "Property name does not exist");
            Assert.IsTrue(response.PropType == PropType.Error );
        }
        public void InvalidReceiveMessage_AddProperty()
        {
            GameObject newGameObject = new GameObject("new game object");
            Property newProperty = new Property(PropertyType.String, "new property", "a new value");
            newGameObject.AddProperty(newProperty);

            Message newMessage = new Message(newGameObject.Name, MessageAction.Add, "new property", "a value", PropType.String);
            Response response = newGameObject.ReceiveMessage(newMessage);

            Assert.IsFalse(response.Status);
            Assert.IsTrue(response.Value == "Property name already exists");
            Assert.IsTrue(response.Property == newProperty.Name);
            Assert.IsTrue(response.PropType == PropType.Error);
        }
 public void ReceiveMessage_AddProperty()
 {
     GameObject newGameObject = new GameObject("new game object");
     Message newMessage = new Message(newGameObject.Name,MessageAction.Add, "new property", "a value", PropType.String);
     Response response = newGameObject.ReceiveMessage(newMessage);
     Assert.IsTrue(response.Status);
     Assert.IsTrue(newGameObject.DoesPropertyExist("new property"));
     Assert.IsTrue("a value" == newGameObject.GetProperty("new property").Value);
 }
        public void ReceiveMessage_SetProperty()
        {
            GameObject newGameObject = new GameObject("new game object");
            Property newProperty = new Property(PropertyType.String, "new property", "a value");
            newGameObject.AddProperty(newProperty);

            Message setMessage = new Message(newGameObject.Name, MessageAction.Set, newProperty.Name,"a new value", PropType.String);
            Response response = newGameObject.ReceiveMessage(setMessage);
            Assert.IsTrue(response.Status);
            Assert.IsTrue(response.Property == newProperty.Name);
            Assert.IsTrue(response.Value != newProperty.Value);
            Assert.IsTrue(response.Value == newGameObject.GetProperty(newProperty.Name).Value);
        }
        public void ReceiveMessage_RemoveProperty()
        {
            GameObject newGameObject = new GameObject("new game object");
            Property newProperty = new Property(PropertyType.String, "new property", "a value");
            newGameObject.AddProperty(newProperty);

            Message removeMessage = new Message(newGameObject.Name,MessageAction.Remove, newProperty.Name);
            Response response = newGameObject.ReceiveMessage(removeMessage);
            Assert.IsTrue(response.Status);
            Assert.IsTrue(response.Property == newProperty.Name);
            Assert.IsTrue(response.Value == "none");
            Assert.IsFalse(newGameObject.DoesPropertyExist(newProperty.Name));
        }