コード例 #1
0
 public void Initialize()
 {
     this.logger        = new Mock <ILogger>();
     this.domainFactory = new Mock <IDomainFactory>();
     this.repository    = new Mock <IRepository>();
     this.storage       =
         new GeneralCommandStorage <TestDomainEntity>(this.logger.Object, this.domainFactory.Object,
                                                      this.repository.Object);
 }
コード例 #2
0
        public GeneralCommandStorageSpec()
        {
            var recorder = new Mock <IRecorder>();

            this.domainFactory = new Mock <IDomainFactory>();
            this.domainFactory.Setup(df =>
                                     df.RehydrateValueObject(typeof(Identifier), It.IsAny <string>()))
            .Returns((Type type, string property) =>
                     "anid".ToIdentifier().As <IPersistableValueObject>());
            this.domainFactory.Setup(df =>
                                     df.RehydrateEntity(typeof(TestDomainEntity), It.IsAny <IReadOnlyDictionary <string, object> >()))
            .Returns((Type type, IReadOnlyDictionary <string, object> props) =>
                     new TestDomainEntity(props[nameof(TestDomainEntity.Id)].ToString().ToIdentifier())
            {
                IsDeleted = (bool?)props[nameof(TestDomainEntity.IsDeleted)]
            });
            this.repository = new Mock <IRepository>();
            this.storage    =
                new GeneralCommandStorage <TestDomainEntity>(recorder.Object, this.domainFactory.Object,
                                                             this.repository.Object);
        }