public void WhenInstantiateAndCreates_ThenReturnsInstance() { var result = TestAggregateRoot.Instantiate()("anid".ToIdentifier(), this.dependencyContainer.Object, new Dictionary <string, object>()); result.Id.Should().Be("anid".ToIdentifier()); }
public void Initialize() { this.logger = new Mock <ILogger>(); this.idFactory = new Mock <IIdentifierFactory>(); this.idFactory.Setup(idf => idf.Create(It.IsAny <IIdentifiableEntity>())) .Returns("anid".ToIdentifier()); this.dependencyContainer = new Mock <IDependencyContainer>(); this.dependencyContainer.Setup(dc => dc.Resolve <ILogger>()) .Returns(this.logger.Object); this.dependencyContainer.Setup(dc => dc.Resolve <IIdentifierFactory>()) .Returns(this.idFactory.Object); this.typeMigrator = new ChangeEventTypeMigrator(); this.aggregate = new TestAggregateRoot(this.logger.Object, this.idFactory.Object); }
public AggregateRootBaseSpec() { var recorder = new Mock <IRecorder>(); var idFactory = new Mock <IIdentifierFactory>(); idFactory.Setup(idf => idf.Create(It.IsAny <IIdentifiableEntity>())) .Returns("anid".ToIdentifier()); this.dependencyContainer = new Mock <IDependencyContainer>(); this.dependencyContainer.Setup(dc => dc.Resolve <IRecorder>()) .Returns(recorder.Object); this.dependencyContainer.Setup(dc => dc.Resolve <IIdentifierFactory>()) .Returns(idFactory.Object); this.typeMigrator = new ChangeEventTypeMigrator(); this.aggregate = new TestAggregateRoot(recorder.Object, idFactory.Object); }
public void WhenInstantiate_ThenRaisesNoEvents() { var container = new Mock <IDependencyContainer>(); container.Setup(c => c.Resolve <ILogger>()) .Returns(NullLogger.Instance); container.Setup(c => c.Resolve <IIdentifierFactory>()) .Returns(new NullIdentifierFactory()); var created = TestAggregateRoot.Instantiate()("anid".ToIdentifier(), container.Object, new Dictionary <string, object>()); created.GetChanges().Should().BeEmpty(); created.LastPersistedAtUtc.Should().BeNull(); created.CreatedAtUtc.Should().Be(DateTime.MinValue); created.LastModifiedAtUtc.Should().Be(DateTime.MinValue); }