public async void DoesValidatorAllowCorrectRequestWithoutClassId() { var db = new FakeDbContext(); var validator = new GetSubscribersCountValidator(db); var request = new GetSubscribersCount(); var result = await validator.ValidateAsync(request); result.IsValid.Should().BeTrue(); }
public async void DoesValidatorPreventFromGettingCountFromNonExistingClass() { var db = new FakeDbContext(); var validator = new GetSubscribersCountValidator(db); var request = new GetSubscribersCount { ClassId = "non-existing-class" }; var result = await validator.ValidateAsync(request); result.IsValid.Should().BeFalse(); result.Errors.Should().HaveCount(1).And.ContainSingle(x => x.ErrorCode == "AsyncPredicateValidator" & x.ErrorMessage == "Mentioned class must already exist."); }