Beispiel #1
0
        private async void BeUniqueByName_Create_Not_Exists()
        {
            Mock <ILinkStatusRepository> linkStatusRepository = new Mock <ILinkStatusRepository>();

            linkStatusRepository.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <LinkStatus>(null));
            var validator = new ApiLinkStatusServerRequestModelValidator(linkStatusRepository.Object);

            await validator.ValidateCreateAsync(new ApiLinkStatusServerRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.Name, "A");
        }
Beispiel #2
0
        public async void Name_Create_length()
        {
            Mock <ILinkStatusRepository> linkStatusRepository = new Mock <ILinkStatusRepository>();

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

            var validator = new ApiLinkStatusServerRequestModelValidator(linkStatusRepository.Object);
            await validator.ValidateCreateAsync(new ApiLinkStatusServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }