Пример #1
0
        public override void SetUp()
        {
            base.SetUp();

            _mockRepository = new MockRepository();

            _persistenceStrategyMock = _mockRepository.StrictMock <IFetchEnabledPersistenceStrategy> ();
            _loadedObjectDataRegistrationAgentMock = _mockRepository.StrictMock <ILoadedObjectDataRegistrationAgent> ();
            _loadedObjectDataProviderStub          = _mockRepository.Stub <ILoadedObjectDataProvider> ();
            _eagerFetcherMock = _mockRepository.StrictMock <IEagerFetcher> ();

            _fetchEnabledObjectLoader = new FetchEnabledObjectLoader(
                _persistenceStrategyMock,
                _loadedObjectDataRegistrationAgentMock,
                _loadedObjectDataProviderStub,
                _eagerFetcherMock);

            _resultItem1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(DomainObjectIDs.Order1);
            _resultItem2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(DomainObjectIDs.Order3);
            _resultItemWithSourceData1 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(DomainObjectIDs.Order1);
            _resultItemWithSourceData2 = LoadedObjectDataObjectMother.CreateLoadedObjectDataWithDataSourceData(DomainObjectIDs.Order3);

            _orderTicketEndPointDefinition = GetEndPointDefinition(typeof(Order), "OrderTicket");
            _customerEndPointDefinition    = GetEndPointDefinition(typeof(Order), "Customer");

            var fetchQuery1 = CreateFakeQuery();
            var fetchQuery2 = CreateFakeQuery();

            _queryWithFetchQueries = CreateFakeQuery(
                Tuple.Create(_orderTicketEndPointDefinition, fetchQuery1),
                Tuple.Create(_customerEndPointDefinition, fetchQuery2));
        }
Пример #2
0
        public override void SetUp()
        {
            base.SetUp();

            _loadedObjectData = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(DomainObjectIDs.Order1);
            _dataSourceData   = DataContainer.CreateForExisting(DomainObjectIDs.Order1, null, pd => pd.DefaultValue);
        }
        public override void SetUp()
        {
            base.SetUp();

            _data1     = LoadedObjectDataObjectMother.CreateFreshlyLoadedObjectData(DomainObjectIDs.Order1);
            _data2     = LoadedObjectDataObjectMother.CreateFreshlyLoadedObjectData(DomainObjectIDs.Order3);
            _collector = new LoadedObjectDataPendingRegistrationCollector();
        }
Пример #4
0
        public void Initialization_IDsDontMatch()
        {
            var loadedObjectDataStub = LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(DomainObjectIDs.Order3);

            Assert.That(
                () => new LoadedObjectDataWithDataSourceData(loadedObjectDataStub, _dataSourceData),
                Throws.ArgumentException.With.Message.EqualTo(
                    "The ID of the dataSourceData parameter does not match the loadedObjectData.\r\nParameter name: dataSourceData"));
        }
        public void AddDataContainers_MultipleTimes_DifferentObjectWithSameObjectID_FirstObjectWins_AndIsReturnedBySecondCall()
        {
            var alternativeData = LoadedObjectDataObjectMother.CreateFreshlyLoadedObjectData(_data1.ObjectID);

            _collector.Add(_data1);
            var resultOfSecondCall = _collector.Add(alternativeData);

            Assert.That(_collector.DataPendingRegistration, Is.EquivalentTo(new[] { _data1 }));
            Assert.That(resultOfSecondCall, Is.SameAs(_data1));
        }
Пример #6
0
 private ILoadedObjectData CreateEquivalentData(ILoadedObjectData loadedObjectData)
 {
     return(LoadedObjectDataObjectMother.CreateLoadedObjectDataStub(loadedObjectData.ObjectID));
 }