예제 #1
0
        public void Should_create_an_overarching_type()
        {
            var messageInfo = MessageInfoCache.GetMessageInfo <OverarchingArgument>();

            ObjectInfo[] objectInfos = MessageInfoCache.GetMessageObjectInfo(messageInfo);

            ObjectInfoContractCache.AddContracts(objectInfos);

            var contract = ObjectInfoContractCache.GetOrAddContract(messageInfo);

            var factory = ContractCache.GetMessageFactory(contract);

            var message = factory.Create();

            var properties = message.GetType().GetProperties();

            Assert.That(properties.Length, Is.EqualTo(2));
            Assert.That(properties[0].Name, Is.EqualTo("CommandId"));
            Assert.That(properties[0].PropertyType, Is.EqualTo(typeof(Guid)));
            Assert.That(properties[1].Name, Is.EqualTo("Argument"));

            properties = properties[1].PropertyType.GetProperties();

            Assert.That(properties.Length, Is.EqualTo(2));
            Assert.That(properties[0].Name, Is.EqualTo("Name"));
            Assert.That(properties[0].PropertyType, Is.EqualTo(typeof(string)));
            Assert.That(properties[1].Name, Is.EqualTo("Age"));
            Assert.That(properties[1].PropertyType, Is.EqualTo(typeof(int)));
        }
예제 #2
0
        public void Should_get_info_for_an_activity()
        {
            var argumentInfo = MessageInfoCache.GetMessageInfo <TestArguments>();
            var logInfo      = MessageInfoCache.GetMessageInfo <TestLog>();
            var objectInfos  = MessageInfoCache.GetMessageObjectInfo(argumentInfo, logInfo);

            Assert.That(objectInfos.Length, Is.EqualTo(2));
        }
예제 #3
0
        public void Should_support_looped_property_types_an_have_object_info()
        {
            var messageInfo = MessageInfoCache.GetMessageInfo <ExceptionInfo>();

            Assert.That(messageInfo, Is.Not.Null);

            ObjectInfo[] objectInfos = MessageInfoCache.GetMessageObjectInfo(messageInfo);

            Assert.That(objectInfos, Is.Not.Null);
            Assert.That(objectInfos.Length, Is.EqualTo(1));
            Assert.That(objectInfos[0].ObjectType, Is.EqualTo(MessageUrn.ForTypeString <ExceptionInfo>()));
        }
예제 #4
0
        public void Should_support_object_property_types_an_have_object_info()
        {
            var messageInfo = MessageInfoCache.GetMessageInfo <NestedArgument>();

            Assert.That(messageInfo, Is.Not.Null);

            ObjectInfo[] objectInfos = MessageInfoCache.GetMessageObjectInfo(messageInfo);

            Assert.That(objectInfos, Is.Not.Null);
            Assert.That(objectInfos.Length, Is.EqualTo(4));
            Assert.That(objectInfos[0].ObjectType, Is.EqualTo(MessageUrn.ForTypeString <SimpleArgument>()));
            Assert.That(objectInfos[1].ObjectType, Is.EqualTo(MessageUrn.ForTypeString <OverarchingArgument>()));
            Assert.That(objectInfos[2].ObjectType, Is.EqualTo(MessageUrn.ForTypeString <DictionaryArgument>()));
            Assert.That(objectInfos[3].ObjectType, Is.EqualTo(MessageUrn.ForTypeString <NestedArgument>()));
        }