Beispiel #1
0
 public ChangeTracker(ICrudRepository crudRepository,
                      IActorContext actorContext,
                      ITrackedChangeRecordConverter trackedChangeRecordConverter,
                      IEventBus eventBus)
 {
     this.crudRepository = crudRepository;
     this.actorContext   = actorContext;
     this.trackedChangeRecordConverter = trackedChangeRecordConverter;
     this.eventBus = eventBus;
 }
Beispiel #2
0
        public ChangeTrackerTests()
        {
            crudRepository = new InMemoryCrudRepository();
            actorContext   = Substitute.For <IActorContext>();
            actorContext.CurrentActorName.Returns("actor");
            eventBus = Substitute.For <IEventBus>();
            FakeClock.Setup();
            FakeClock.Now = DateTime.Today;
            trackedChangeRecordConverter = Substitute.For <ITrackedChangeRecordConverter>();

            Mapper.Reset(); // TODO will break if other parallel tests call this too
            Mapper.Initialize(cfg => cfg.AddProfile(new HistoryAutoMapperProfile(trackedChangeRecordConverter)));

            sut = new ChangeTracker(crudRepository, actorContext, trackedChangeRecordConverter, eventBus);
        }
Beispiel #3
0
        public ChangeTrackerTests()
        {
            crudRepository = new InMemoryCrudRepository();
            actorContext   = Substitute.For <IActorContext>();
            actorContext.CurrentActorName.Returns("actor");
            eventBus = Substitute.For <IEventBus>();
            FakeClock.Setup();
            FakeClock.Now = DateTime.Today;
            trackedChangeRecordConverter = Substitute.For <ITrackedChangeRecordConverter>();

            var mapperConfig = new MapperConfiguration(configurationExpression =>
            {
                configurationExpression.AddProfile(new HistoryAutoMapperProfile(trackedChangeRecordConverter));
            });

            mapper = mapperConfig.CreateMapper();

            sut = new ChangeTracker(crudRepository, actorContext,
                                    trackedChangeRecordConverter, eventBus, mapper);
        }
 public HistoryAutoMapperProfile(ITrackedChangeRecordConverter trackedChangeRecordConverter)
 {
     CreateMap <TrackedChangeRecord, TrackedChange>()
     .ConvertUsing(x => trackedChangeRecordConverter.FromRecord(x));
 }