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)); }
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); }
public void GetResourceManager() { var resourceManagerStub1 = MockRepository.GenerateStub <IResourceManager>(); var resourceManagerStub2 = MockRepository.GenerateStub <IResourceManager>(); var resourceManagerStub3 = MockRepository.GenerateStub <IResourceManager>(); using (_mockRepository.Ordered()) { _innerService3.Expect(mock => mock.GetResourceManager(_typeInformationStub)).Return(resourceManagerStub1); _innerService2.Expect(mock => mock.GetResourceManager(_typeInformationStub)).Return(resourceManagerStub2); _innerService1.Expect(mock => mock.GetResourceManager(_typeInformationStub)).Return(resourceManagerStub3); } _mockRepository.ReplayAll(); var result = _service.GetResourceManager(_typeInformationStub); Assert.That(result, Is.TypeOf(typeof(ResourceManagerSet))); Assert.That(((ResourceManagerSet)result).ResourceManagers, Is.EqualTo(new[] { resourceManagerStub1, resourceManagerStub2, resourceManagerStub3 })); _mockRepository.VerifyAll(); }