コード例 #1
0
        public void SimpleAIDataElementTestForIntegerNotInitialized()
        {
            //Arrange
            var simpleInteger = new SimpleAIDataElement <int?>();

            //Assert
            Assert.IsFalse(simpleInteger.GetAsBoolean());
            Assert.IsNull(simpleInteger.GetDataValue());
            Assert.AreEqual(simpleInteger.GetDataType(), typeof(int?));
        }
コード例 #2
0
        public void BlackBoardBaseAddToInts()
        {
            //Arrange
            string key   = "NULLABLE_INT";
            int    value = 1;
            SimpleAIDataElement <int> simpleDataElement = new SimpleAIDataElement <int>(value);

            //Act
            BlackBoard.Instance.Objects.Add(key, simpleDataElement);
            SimpleAIDataElement <int> result = (SimpleAIDataElement <int>)BlackBoard.Instance.Objects[key];

            //Assert
            Assert.AreEqual(value.GetType(), result.GetDataType());
            Assert.AreEqual(value, result.GetDataValue());
        }
コード例 #3
0
        public void BlackBoardBaseAddSimpleAIDataElementToObjects()
        {
            //Arrange
            string key   = "SIMPLE_AI_DATA_ELEMENT";
            int    value = 1;
            SimpleAIDataElement <int> simpleAIDataElement = new SimpleAIDataElement <int>();

            simpleAIDataElement.SetDataValue(value);

            //Act
            BlackBoard.Instance.Objects.Add(key, simpleAIDataElement);
            SimpleAIDataElement <int> result = (SimpleAIDataElement <int>)BlackBoard.Instance.Objects[key];

            //Assert
            Assert.AreEqual(value.GetType(), result.GetDataType());
            Assert.AreEqual(value, result.GetDataValue());
        }