Ejemplo n.º 1
0
        public SingleDataContainerAssociateWithIDCommand(ObjectID expectedObjectID, IStorageProviderCommand <DataContainer, TExecutionContext> innerCommand)
        {
            ArgumentUtility.CheckNotNull("expectedObjectID", expectedObjectID);
            ArgumentUtility.CheckNotNull("innerCommand", innerCommand);

            _expectedObjectID = expectedObjectID;
            _innerCommand     = innerCommand;
        }
 private IStorageProviderCommand <TIn, IRdbmsProviderCommandExecutionContext> CheckDelegateBasedCommandAndReturnInnerCommand <TIn, TResult> (
     IStorageProviderCommand <TResult, IRdbmsProviderCommandExecutionContext> command)
 {
     Assert.That(
         command,
         Is.TypeOf(typeof(DelegateBasedCommand <TIn, TResult, IRdbmsProviderCommandExecutionContext>)));
     return(((DelegateBasedCommand <TIn, TResult, IRdbmsProviderCommandExecutionContext>)command).Command);
 }
Ejemplo n.º 3
0
        public IndirectDataContainerLoadCommand(
            IStorageProviderCommand <IEnumerable <ObjectID>, IRdbmsProviderCommandExecutionContext> objectIDLoadCommand,
            IStorageProviderCommandFactory <IRdbmsProviderCommandExecutionContext> storageProviderCommandFactory)
        {
            ArgumentUtility.CheckNotNull("objectIDLoadCommand", objectIDLoadCommand);
            ArgumentUtility.CheckNotNull("storageProviderCommandFactory", storageProviderCommandFactory);

            _objectIDLoadCommand           = objectIDLoadCommand;
            _storageProviderCommandFactory = storageProviderCommandFactory;
        }
        public MultiDataContainerAssociateWithIDsCommand(
            IEnumerable <ObjectID> objectIDs,
            IStorageProviderCommand <IEnumerable <DataContainer>, IRdbmsProviderCommandExecutionContext> command)
        {
            ArgumentUtility.CheckNotNull("objectIDs", objectIDs);
            ArgumentUtility.CheckNotNull("command", command);

            _objectIDs = objectIDs.ToArray();
            _command   = command;
        }
Ejemplo n.º 5
0
        public override void SetUp()
        {
            base.SetUp();

            _commandStub      = MockRepository.GenerateStub <IStorageProviderCommand <IEnumerable <DataContainer>, IRdbmsProviderCommandExecutionContext> >();
            _executionContext = MockRepository.GenerateStub <IRdbmsProviderCommandExecutionContext>();

            _order1Container = DataContainerObjectMother.Create(DomainObjectIDs.Order1);
            _order2Container = DataContainerObjectMother.Create(DomainObjectIDs.Order3);
            _order3Container = DataContainerObjectMother.Create(DomainObjectIDs.Order4);
        }
Ejemplo n.º 6
0
        public override void SetUp()
        {
            base.SetUp();

            _expectedID       = DomainObjectIDs.Order1;
            _innerCommandMock = MockRepository.GenerateStrictMock <IStorageProviderCommand <DataContainer, object> >();

            _associateCommand = new SingleDataContainerAssociateWithIDCommand <object> (_expectedID, _innerCommandMock);

            _fakeContext = "context";
        }
Ejemplo n.º 7
0
        public override void SetUp()
        {
            base.SetUp();

            _fakeResult = new ObjectLookupResult <DataContainer> [0];
            _objectID1  = DomainObjectIDs.Order1;
            _objectID2  = DomainObjectIDs.Order3;
            _commandExecutionContextStub = MockRepository.GenerateStub <IRdbmsProviderCommandExecutionContext>();
            _commandExecutionContextStub = MockRepository.GenerateStub <IRdbmsProviderCommandExecutionContext>();

            _objectIDLoadCommandStub = MockRepository.GenerateStub <IStorageProviderCommand <IEnumerable <ObjectID>, IRdbmsProviderCommandExecutionContext> >();
            _objectIDLoadCommandStub.Stub(stub => stub.Execute(_commandExecutionContextStub)).Return(new[] { _objectID1, _objectID2 });

            _dataContainerLoadCommandStub =
                MockRepository.GenerateStub <IStorageProviderCommand <ObjectLookupResult <DataContainer>[], IRdbmsProviderCommandExecutionContext> >();
            _dataContainerLoadCommandStub.Stub(stub => stub.Execute(_commandExecutionContextStub)).Return(_fakeResult);

            _storageProviderFactoryStub = MockRepository.GenerateStub <IStorageProviderCommandFactory <IRdbmsProviderCommandExecutionContext> >();
            _storageProviderFactoryStub
            .Stub(stub => stub.CreateForSortedMultiIDLookup(Arg <ObjectID[]> .List.Equal(new[] { _objectID1, _objectID2 })))
            .Return(_dataContainerLoadCommandStub);

            _loadCommand = new IndirectDataContainerLoadCommand(_objectIDLoadCommandStub, _storageProviderFactoryStub);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates instances of <see cref="DelegateBasedCommand{TIn,TOut,TExecutionContext}"/>. Use this factory method to avoid having
 /// to pass all generic arguments to <see cref="DelegateBasedCommand{TIn,TOut,TExecutionContext}"/>'s constructor by hand.
 /// </summary>
 public static DelegateBasedCommand <TIn, TOut, TExecutionContext> Create <TIn, TOut, TExecutionContext> (
     IStorageProviderCommand <TIn, TExecutionContext> command,
     Func <TIn, TOut> operation)
 {
     return(new DelegateBasedCommand <TIn, TOut, TExecutionContext> (command, operation));
 }