Exemplo n.º 1
0
        public void Register_WhenChangeOfSupplierIsRegisteredOnSameDate_IsNotPossible()
        {
            var customerId       = CreateCustomerId();
            var energySupplierId = CreateEnergySupplierId();
            var meteringPoint    = CreateMeteringPoint(MeteringPointType.Consumption);

            meteringPoint.RegisterMoveIn(customerId, energySupplierId, GetFakeEffectuationDate().Minus(Duration.FromDays(1)));
            meteringPoint.ActivateMoveIn(customerId, energySupplierId);
            meteringPoint.RegisterChangeOfEnergySupplier(CreateEnergySupplierId(), _systemDateTimeProvider.Now(), _systemDateTimeProvider);

            var result = CanChangeSupplier(meteringPoint);

            Assert.Contains(result.Errors, x => x.Rule == typeof(ChangeOfSupplierRegisteredOnSameDateIsNotAllowedRule));
        }
Exemplo n.º 2
0
        public void Register_WhenNoBlockingProcessIsRegistered_IsSuccess()
        {
            var processCoordinator = Create();

            var processId     = CreateProcessId();
            var effectiveDate = _systemDateTimeProvider.Now();

            processCoordinator.Register(new ChangeOfSupplierProcess(processId, effectiveDate));

            var @event = processCoordinator.DomainEvents !.First() as ProcessRegistered;

            Assert.Equal(processId, @event !.ProcessId);
        }