public void Generate_WhenCalled_ResultIsNotNullOrEmptyAndAreSixCharactersLong()
        {
            var generator = new HumanReadableUniqueId();
            var result    = generator.Generate();

            result.ShouldNotBeNullOrEmpty();
            result.Length.ShouldBe(6);
        }
        public void Factory_InstanceIsSet_UsesCurrentInstanceInsteadOfNew()
        {
            var humanReadableUniqueIdMock = Substitute.For <IHumanReadableUniqueId>();

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

            HumanReadableUniqueId.Instance = humanReadableUniqueIdMock;
            HumanReadableUniqueId.NewUid().ShouldBe("test1");
        }
        public void Generate_WhenCalledMutipleTimes_ResultIsUnique()
        {
            var generator = new HumanReadableUniqueId();

            var resultId1 = generator.Generate();
            var resultId2 = generator.Generate();
            var resultId3 = generator.Generate();

            resultId3.ShouldNotBe(resultId1);
            resultId3.ShouldNotBe(resultId2);
        }
        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);
 }