Esempio n. 1
0
        public async void Name_Update_length()
        {
            Mock <IChainStatusRepository> chainStatusRepository = new Mock <IChainStatusRepository>();

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

            var validator = new ApiChainStatusServerRequestModelValidator(chainStatusRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiChainStatusServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
Esempio n. 2
0
        private async void BeUniqueByName_Update_Not_Exists()
        {
            Mock <IChainStatusRepository> chainStatusRepository = new Mock <IChainStatusRepository>();

            chainStatusRepository.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <ChainStatus>(null));
            var validator = new ApiChainStatusServerRequestModelValidator(chainStatusRepository.Object);

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

            validator.ShouldNotHaveValidationErrorFor(x => x.Name, "A");
        }