public void GetObject_WithoutService() { var bindableObjectClass = new BindableObjectClassWithIdentity( MixinTypeUtility.GetConcreteMixedType(typeof(ClassWithIdentity)), _bindableObjectProvider, _bindableObjectGlobalizationService, new PropertyBase[0]); bindableObjectClass.GetObject("TheUniqueIdentifier"); }
public void GetObject_WithCustomService() { var bindableObjectClass = new BindableObjectClassWithIdentity( MixinTypeUtility.GetConcreteMixedType(typeof(ClassWithIdentityAndGetObjectServiceAttribute)), _bindableObjectProvider, _bindableObjectGlobalizationService, new PropertyBase[0]); var mockService = _mockRepository.StrictMock <ICustomGetObjectService>(); var expected = _mockRepository.Stub <IBusinessObjectWithIdentity>(); Expect.Call(mockService.GetObject(bindableObjectClass, "TheUniqueIdentifier")).Return(expected); _mockRepository.ReplayAll(); _bindableObjectProvider.AddService(typeof(ICustomGetObjectService), mockService); IBusinessObjectWithIdentity actual = bindableObjectClass.GetObject("TheUniqueIdentifier"); _mockRepository.VerifyAll(); Assert.That(actual, Is.SameAs(expected)); }