Ejemplo n.º 1
0
        public void GetOriginalCollectionReference_Twice_ForSameID()
        {
            var collection = new DomainObjectCollection(_associatedDataStrategyStub);

            _collectionProviderMock
            .Expect(mock => mock.GetCollection(_endPointID))
            .Return(collection)
            .Repeat.Once();
            _collectionProviderMock.Replay();

            var result1 = _manager.GetOriginalCollectionReference();
            var result2 = _manager.GetOriginalCollectionReference();

            _associatedCollectionDataStrategyFactoryMock.VerifyAllExpectations();

            Assert.That(result2, Is.SameAs(result1));
        }
        public void GetCollection()
        {
            _associatedCollectionDataStrategyFactoryMock
            .Expect(mock => mock.CreateDataStrategyForEndPoint(_endPointID))
            .Return(_dataStrategyStub);
            _associatedCollectionDataStrategyFactoryMock.Replay();

            _dataStrategyStub.Stub(stub => stub.AssociatedEndPointID).Return(_endPointID);

            var result = _provider.GetCollection(_endPointID);

            _associatedCollectionDataStrategyFactoryMock.VerifyAllExpectations();
            Assert.That(result, Is.TypeOf <OrderCollection> ());
            Assert.That(DomainObjectCollectionDataTestHelper.GetDataStrategy(result), Is.SameAs(_dataStrategyStub));

            Assert.That(result, Is.SameAs(_provider.GetCollection(_endPointID)));
        }