public void IsNullable_NoAttribute() { _propertyInformationStub.Stub(stub => stub.GetCustomAttribute <INullablePropertyAttribute> (true)).Return(null); var result = _domainModelConstraintProvider.IsNullable(_propertyInformationStub); Assert.That(result, Is.True); }
public override void SetUp() { base.SetUp(); _classDefinition = ClassDefinitionObjectMother.CreateClassDefinition(); _propertyInformationStub = MockRepository.GenerateStub <IPropertyInformation>(); _propertyInformationStub.Stub(stub => stub.Name).Return("Test"); _propertyInformationStub.Stub(stub => stub.DeclaringType).Return(TypeAdapter.Create(typeof(Order))); _propertyInformationStub.Stub(stub => stub.GetOriginalDeclaringType()).Return(TypeAdapter.Create(typeof(Order))); }
public void SetUp() { _globalizationServiceMock = MockRepository.GenerateStub <IGlobalizationService>(); _resourceManagerMock = MockRepository.GenerateStrictMock <IResourceManager>(); _resourceManagerMock.Stub(stub => stub.IsNull).Return(false); _resourceManagerMock.Stub(stub => stub.Name).Return("RM1"); _typeInformationStub = MockRepository.GenerateStub <ITypeInformation>(); _typeInformationStub.Stub(stub => stub.Name).Return("TypeName"); _typeInformationForResourceResolutionStub = MockRepository.GenerateStub <ITypeInformation>(); _typeInformationForResourceResolutionStub.Stub(stub => stub.Name).Return("TypeNameForResourceResolution"); _propertyInformationStub = MockRepository.GenerateStub <IPropertyInformation>(); _propertyInformationStub.Stub(stub => stub.Name).Return("PropertyName"); _memberInformationNameResolverStub = MockRepository.GenerateStub <IMemberInformationNameResolver>(); _memberInformationNameResolverStub.Stub(stub => stub.GetPropertyName(_propertyInformationStub)).Return("FakePropertyFullName"); _memberInformationNameResolverStub.Stub(stub => stub.GetTypeName(_typeInformationStub)).Return("FakeTypeFullName"); _shortPropertyResourceID = "property:PropertyName"; _longPropertyResourceID = "property:FakePropertyFullName"; _shortTypeResourceID = "type:TypeName"; _longTypeResourceID = "type:FakeTypeFullName"; _service = new ResourceManagerBasedMemberInformationGlobalizationService(_globalizationServiceMock, _memberInformationNameResolverStub); }
public void SetUp() { _typeInformationStub = MockRepository.GenerateStub <ITypeInformation>(); _typeInformationStub.Stub(stub => stub.Name).Return("TypeName"); _propertyInformationStub = MockRepository.GenerateStub <IPropertyInformation>(); _propertyInformationStub.Stub(stub => stub.Name).Return("PropertyName"); _typeInformationForResourceResolutionStub = MockRepository.GenerateStub <ITypeInformation>(); _serviceStub = MockRepository.GenerateStub <IMemberInformationGlobalizationService> (); }
public void CanBeSetFromOutside_IsBasedOnGetSetMethod_TrueForInterfaceImplementationPropertySetter() { var methodInfoAdapter = MethodInfoAdapter.Create(typeof(object).GetMethod("ToString")); _implementationPropertyInformationStub.Stub(stub => stub.GetSetMethod(true)).Return(methodInfoAdapter); _declarationPropertyInformationStub.Stub(stub => stub.GetSetMethod(false)).Return(methodInfoAdapter); Assert.That(_mixinIntroducedPropertyInformation.CanBeSetFromOutside, Is.True); }
public void SetValue() { var instance = new ClassWithReferenceType <SimpleReferenceType>(); var value = new SimpleReferenceType(); _declarationPropertyInformationStub.Stub(stub => stub.GetSetMethod(true)).Return( MethodInfoAdapter.Create(typeof(IInterfaceWithReferenceType <SimpleReferenceType>).GetProperty("ImplicitInterfaceScalar").GetSetMethod(true))); _implementationPropertyInformationStub.Stub(stub => stub.GetSetMethod(true)).Return( MethodInfoAdapter.Create(typeof(ClassWithReferenceType <SimpleReferenceType>).GetProperty("ImplicitInterfaceScalar").GetSetMethod(true))); _interfaceImplementationPropertyInformation.SetValue(instance, value, null); Assert.That(instance.ImplicitInterfaceScalar, Is.SameAs(value)); }
public void Name() { _implementationPropertyInformationStub.Stub(stub => stub.Name).Return("Test"); Assert.That(_interfaceImplementationPropertyInformation.Name, Is.EqualTo("Test")); }
public void Name() { _implementationPropertyInformationStub.Stub(stub => stub.Name).Return("Test"); Assert.That(_mixinIntroducedPropertyInformation.Name, Is.EqualTo("Test")); }
public void Initialize() { _propertyInformationStub.Stub(stub => stub.PropertyType).Return(typeof(string)); var actual = new PropertyDefinition( _classDefinition, _propertyInformationStub, "Test", false, false, null, StorageClass.Persistent); Assert.That(actual.ClassDefinition, Is.SameAs(_classDefinition)); Assert.That(actual.IsNullable, Is.False); Assert.That(actual.MaxLength, Is.Null); Assert.That(actual.PropertyName, Is.EqualTo("Test")); Assert.That(actual.PropertyType, Is.EqualTo(typeof(string))); Assert.That(actual.StorageClass, Is.EqualTo(StorageClass.Persistent)); Assert.That(actual.IsObjectID, Is.False); Assert.That(actual.PropertyInfo, Is.SameAs(_propertyInformationStub)); }
public void GetPropertyName() { _typeInformationStub.Stub(stub => stub.FullName).Return("Namespace.Class"); _propertyInformationStub.Stub(stub => stub.Name).Return("Property"); _propertyInformationStub.Stub(stub => stub.GetOriginalDeclaringType()).Return(_typeInformationStub); Assert.That(_resolver.GetPropertyName(_propertyInformationStub), Is.EqualTo("Namespace.Class.Property")); }