public ContactCommandHandlers(IUseRepo <Contact> useRepo, ICommandBus bus, ITimeService timeService, ISecurityPrincipalService principalService)
            : base(useRepo, timeService.UtcNow, principalService.ActiveUserName)
        {
            Name = ContactEvent.AggregateName;

            _subscriptions =
                Seq(new[]
            {
                bus.Subscribe <ReadContact>(Handle),
                bus.Subscribe <CreateContact>(Handle),
                bus.Subscribe <RenameContact>(Handle),
                bus.Subscribe <AddContactPhone>(Handle),
                bus.Subscribe <UpdateContactPhone>(Handle),
            });
        }
        protected CommandHandlers(IUseRepo <T> useRepo, Func <DateTimeOffset> utcNow, Func <string> owner)
        {
            if (useRepo == null)
            {
                throw new ArgumentNullException("useRepo");
            }
            if (utcNow == null)
            {
                throw new ArgumentNullException("utcNow");
            }
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }

            UseRepo = useRepo.UseRepo;
            UtcNow  = utcNow;
            Owner   = owner;
        }
Esempio n. 3
0
 public UnitTest2()
 {
     useRepo2 = Substitute.For <IUseRepo>();
     useRepo2.Name.Returns("2");
 }