public SetIpdcCode(
     PublicServiceId publicServiceId,
     IpdcCode ipdcCode)
 {
     PublicServiceId = publicServiceId;
     IpdcCode        = ipdcCode;
 }
        public void SetIpdcCode(IpdcCode ipdcCode)
        {
            EnsureNotRemoved();
            EnsureIpdcCodeNotSet();

            ApplyChange(new IpdcCodeWasSet(_id, ipdcCode));
        }
예제 #3
0
 public IpdcCodeWasSet(
     PublicServiceId publicServiceId,
     IpdcCode ipdcCode)
 {
     PublicServiceId = publicServiceId;
     IpdcCode        = ipdcCode;
 }
 public void NonAdminsCantSetIpdcCode(
     PublicServiceId publicServiceId,
     PublicServiceName publicServiceName,
     IpdcCode ipdcCode)
 {
     Assert(
         new Scenario()
         .Given(publicServiceId,
                new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered))
         .When(new SetIpdcCode(publicServiceId, ipdcCode))
         .Throws(new InsufficientRights()));
 }
 public void WhenIpdcCodeHasNotBeenSetBefore(
     PublicServiceId publicServiceId,
     PublicServiceName publicServiceName,
     IpdcCode ipdcCode)
 {
     Assert(
         new Scenario()
         .Given(publicServiceId,
                new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered))
         .When(new SetIpdcCode(publicServiceId, ipdcCode).PerformedByAdmin())
         .Then(publicServiceId,
               new IpdcCodeWasSet(publicServiceId, ipdcCode)));
 }
 public void CantSetAnIpdcCodeOnARemovedPublicService(
     PublicServiceId publicServiceId,
     PublicServiceName publicServiceName,
     ReasonForRemoval reasonForRemoval,
     IpdcCode ipdcCode)
 {
     Assert(
         new Scenario()
         .Given(publicServiceId,
                new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered),
                new PublicServiceWasRemoved(publicServiceId, reasonForRemoval))
         .When(new SetIpdcCode(publicServiceId, ipdcCode).PerformedByAdmin())
         .Throws(new CannotPerformActionOnRemovedPublicService()));
 }
 private void When(IpdcCodeWasSet @event)
 {
     _ipdcCode = new IpdcCode(@event.IpdcCode);
 }
        public void WithValidCode()
        {
            var ipdcCode = new IpdcCode("1111");

            ipdcCode.Should().Be(new IpdcCode("1111"));
        }