Beispiel #1
0
        public IFixtureArranger <TAggregate, TIdentity> For(TIdentity aggregateId)
        {
            if (aggregateId == null)
            {
                throw new ArgumentNullException(nameof(aggregateId));
            }

            if (!AggregateTestProbe.IsNobody())
            {
                throw new InvalidOperationException(nameof(AggregateTestProbe));
            }

            AggregateId          = aggregateId;
            AggregateTestProbe   = _testKit.CreateTestProbe("aggregate-probe");
            AggregateProps       = Props.Create <TAggregate>(args: aggregateId);
            AggregateRef         = ActorRefs.Nobody;
            UsesAggregateManager = false;

            return(this);
        }
Beispiel #2
0
        public IFixtureArranger <TAggregate, TIdentity> Using <TAggregateManager>(
            Expression <Func <TAggregateManager> > aggregateManagerFactory, TIdentity aggregateId)
            where TAggregateManager : ReceiveActor, IAggregateManager <TAggregate, TIdentity>
        {
            if (aggregateId == null)
            {
                throw new ArgumentNullException(nameof(aggregateId));
            }
            if (!AggregateTestProbe.IsNobody())
            {
                throw new InvalidOperationException(nameof(AggregateTestProbe));
            }

            AggregateId          = aggregateId;
            AggregateTestProbe   = _testKit.CreateTestProbe("aggregate-probe");
            AggregateRef         = _testKit.Sys.ActorOf(Props.Create(aggregateManagerFactory), "aggregate-manager");
            UsesAggregateManager = false;
            AggregateProps       = Props.Empty;

            return(this);
        }