public void Factory_InstanceIsSet_UsesCurrentInstanceInsteadOfNew()
        {
            var humanReadableUniqueIdMock = Substitute.For <IHumanReadableUniqueId>();

            humanReadableUniqueIdMock.Generate().Returns("test1");

            HumanReadableUniqueId.Instance = humanReadableUniqueIdMock;
            HumanReadableUniqueId.NewUid().ShouldBe("test1");
        }
        public void Post(string associationId, [FromBody] List <AssociationAddressRegister> addresses)
        {
            foreach (var address in addresses)
            {
                _commandProcessor.ProcessCommand(new AddAddressToAssociationCommand(associationId)
                {
                    Id            = address.Id,
                    City          = address.City,
                    Zip           = address.Zip,
                    Country       = "+45",
                    Door          = address.Door,
                    Floor         = address.Floor,
                    No            = address.No,
                    StreetAddress = address.Streetname
                });

                _commandProcessor.ProcessCommand(new AddCodeToAddressCommand(associationId)
                {
                    AddressId = address.Id,
                    Code      = HumanReadableUniqueId.NewUid()
                });
            }
        }
 public void Factory_InstanceIsNotSet_UsesNewCreatedInstance()
 {
     HumanReadableUniqueId.Instance = null;
     HumanReadableUniqueId.NewUid().Length.ShouldBe(6);
 }