public void GivenType_GetDefaultPropertyType_ReturnsDefaultPropertyType(Type nativeType, Type expectedDefaultType) { PageDefinitionTypeMapper mapper = new PageDefinitionTypeMapper(null); Type returnedType = mapper.GetDefaultPropertyType(nativeType); Assert.Equal <Type>(expectedDefaultType, returnedType); }
public void GivenPageTypePropertyDefinitionWithNoTypeSet_GetPropertyType_GetsDefaultPropertyTypeForDefinitionsPropertyType() { PageTypePropertyDefinition definition = PageTypePropertyUpdaterTestsUtility.CreatePageTypePropertyDefinition(); definition.PageTypePropertyAttribute.Type = null; MockRepository fakes = new MockRepository(); PageDefinitionTypeMapper pageDefinitionTypeMapper = fakes.PartialMock <PageDefinitionTypeMapper>((PageDefinitionTypeFactory)null); Type defaultType = typeof(string); pageDefinitionTypeMapper.Stub(utility => utility.GetDefaultPropertyType(definition.PropertyType)).Return(defaultType); pageDefinitionTypeMapper.Replay(); Type returnedType = pageDefinitionTypeMapper.GetDefaultPropertyType(definition.PropertyType); pageDefinitionTypeMapper.AssertWasCalled(utility => utility.GetDefaultPropertyType(definition.PropertyType)); Assert.Equal <Type>(defaultType, returnedType); }
public void GivenType_GetDefaultPropertyType_ReturnsDefaultPropertyType(Type nativeType, Type expectedDefaultType) { PageDefinitionTypeMapper mapper = new PageDefinitionTypeMapper(null, new NativePageDefinitionsMap()); Type returnedType = mapper.GetDefaultPropertyType(nativeType); Assert.Equal<Type>(expectedDefaultType, returnedType); }