public void GetResourceManager()
        {
            var fakeResult = MockRepository.GenerateStub <IResourceManager>();

            _globalizationServiceMock
            .Expect(mock => mock.GetResourceManager(Arg <ITypeInformation> .Matches(ti => ((TypeAdapter)ti).Type == typeof(string))))
            .Return(fakeResult);

            var result = _globalizationServiceMock.GetResourceManager(typeof(string));

            _globalizationServiceMock.VerifyAllExpectations();
            Assert.That(result, Is.SameAs(fakeResult));
        }
Пример #2
0
        public void TryGetPropertyDisplayName_NoResourceFound()
        {
            _globalizationServiceMock.Expect(mock => mock.GetResourceManager(_typeInformationStub)).Return(_resourceManagerMock);

            _resourceManagerMock.Expect(mock => mock.TryGetString(Arg.Is(_longPropertyResourceID), out Arg <string> .Out(null).Dummy)).Return(false);
            _resourceManagerMock.Expect(mock => mock.TryGetString(Arg.Is(_shortPropertyResourceID), out Arg <string> .Out(null).Dummy)).Return(false);

            string resourceValue;
            var    result = _service.TryGetPropertyDisplayName(_propertyInformationStub, _typeInformationStub, out resourceValue);

            _globalizationServiceMock.VerifyAllExpectations();
            _resourceManagerMock.VerifyAllExpectations();
            Assert.That(result, Is.False);
            Assert.That(resourceValue, Is.Null);
        }