Exemple #1
0
        public void Search_WithSearchNotSupported()
        {
            IBusinessObject                  businessObject       = (IBusinessObject)ObjectFactory.Create <ClassWithBusinessObjectProperties> (ParamList.Empty);
            ISearchServiceOnProperty         mockService          = _mockRepository.StrictMock <ISearchServiceOnProperty>();
            IBusinessObjectReferenceProperty property             = CreateProperty("SearchServiceFromPropertyDeclaration");
            ISearchAvailableObjectsArguments searchArgumentsStubb = _mockRepository.Stub <ISearchAvailableObjectsArguments>();

            Expect.Call(mockService.SupportsProperty(property)).Return(false);
            _mockRepository.ReplayAll();

            _bindableObjectProviderForDeclaringType.AddService(mockService);
            try
            {
                property.SearchAvailableObjects(businessObject, searchArgumentsStubb);
            }
            finally
            {
                _mockRepository.VerifyAll();
            }
        }
Exemple #2
0
        public void Search_WithSearchSupported()
        {
            IBusinessObject                  stubBusinessObject = _mockRepository.Stub <IBusinessObject>();
            ISearchServiceOnProperty         mockService        = _mockRepository.StrictMock <ISearchServiceOnProperty>();
            IBusinessObjectReferenceProperty property           = CreateProperty("SearchServiceFromPropertyDeclaration");

            IBusinessObject[] expected = new IBusinessObject[0];
            ISearchAvailableObjectsArguments searchArgumentsStub = _mockRepository.Stub <ISearchAvailableObjectsArguments>();

            using (_mockRepository.Ordered())
            {
                Expect.Call(mockService.SupportsProperty(property)).Return(true);
                Expect.Call(mockService.Search(stubBusinessObject, property, searchArgumentsStub)).Return(expected);
            }
            _mockRepository.ReplayAll();

            _bindableObjectProviderForDeclaringType.AddService(mockService);
            IBusinessObject[] actual = property.SearchAvailableObjects(stubBusinessObject, searchArgumentsStub);

            _mockRepository.VerifyAll();
            Assert.That(actual, Is.SameAs(expected));
        }