Exemplo n.º 1
0
        public void GetNativeTypeId_ReturnsCorrectId(Type propertyType, int index)
        {
            NativePageDefinitionsMap map = new NativePageDefinitionsMap();

            var typeId = map.GetNativeTypeID(propertyType);

            Assert.Equal <int>(index, typeId);
        }
Exemplo n.º 2
0
        public void GivenNonNativeType_GetNativeTypeID_ThrowsException()
        {
            var  mapper        = new NativePageDefinitionsMap();
            Type nonNativeType = typeof(string);

            Exception exception = Record.Exception(() => { mapper.GetNativeTypeID(nonNativeType); });

            Assert.NotNull(exception);
        }
Exemplo n.º 3
0
        public void GivenPageTypePropertyDefinitionWithNativeType_GetPageDefinitionType_ReturnsCorrectPageDefinitionType()
        {
            PageTypePropertyDefinition definition = PageDefinitionSynchronizationEngineTestsUtility.CreatePageTypePropertyDefinition();

            definition.PageTypePropertyAttribute.Type = typeof(PropertyString);
            MockRepository fakes = new MockRepository();
            PageDefinitionTypeRepository fakeRepository = fakes.Stub <PageDefinitionTypeRepository>();
            PageDefinitionTypeMapper     mapper         = new PageDefinitionTypeMapper(fakeRepository, new NativePageDefinitionsMap());
            int nativeTypeID = new NativePageDefinitionsMap().GetNativeTypeID(definition.PageTypePropertyAttribute.Type);
            PageDefinitionType pageDefinitionTypeFromFactory = new PageDefinitionType(1, PropertyDataType.String, TestValueUtility.CreateRandomString());

            fakeRepository.Stub(factory => factory.GetPageDefinitionType(nativeTypeID)).Return(pageDefinitionTypeFromFactory);
            fakeRepository.Replay();

            PageDefinitionType returnedPageDefinitionType = mapper.GetPageDefinitionType(definition);

            Assert.Equal <PageDefinitionType>(pageDefinitionTypeFromFactory, returnedPageDefinitionType);
        }