public async void Name_Update_length()
        {
            Mock <ILinkRepository> linkRepository = new Mock <ILinkRepository>();

            linkRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Link()));

            var validator = new ApiLinkServerRequestModelValidator(linkRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiLinkServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
        private async void BeUniqueByExternalId_Update_Exists()
        {
            Mock <ILinkRepository> linkRepository = new Mock <ILinkRepository>();

            linkRepository.Setup(x => x.ByExternalId(It.IsAny <Guid>())).Returns(Task.FromResult <Link>(new Link()));
            var validator = new ApiLinkServerRequestModelValidator(linkRepository.Object);

            await validator.ValidateUpdateAsync(default(int), new ApiLinkServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ExternalId, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
        public async void Name_Create_null()
        {
            Mock <ILinkRepository> linkRepository = new Mock <ILinkRepository>();

            linkRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Link()));

            var validator = new ApiLinkServerRequestModelValidator(linkRepository.Object);
            await validator.ValidateCreateAsync(new ApiLinkServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, null as string);
        }
        public async void ChainId_Create_Invalid_Reference()
        {
            Mock <ILinkRepository> linkRepository = new Mock <ILinkRepository>();

            linkRepository.Setup(x => x.ChainByChainId(It.IsAny <int>())).Returns(Task.FromResult <Chain>(null));

            var validator = new ApiLinkServerRequestModelValidator(linkRepository.Object);

            await validator.ValidateCreateAsync(new ApiLinkServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ChainId, 1);
        }
        public async void AssignedMachineId_Update_Invalid_Reference()
        {
            Mock <ILinkRepository> linkRepository = new Mock <ILinkRepository>();

            linkRepository.Setup(x => x.MachineByAssignedMachineId(It.IsAny <int>())).Returns(Task.FromResult <Machine>(null));

            var validator = new ApiLinkServerRequestModelValidator(linkRepository.Object);

            await validator.ValidateUpdateAsync(default(int), new ApiLinkServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.AssignedMachineId, 1);
        }