示例#1
0
        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 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"));
        }