public void GetLanguageByIdValidatorShouldReturnFalseWhenIdIsNull() { IValidator <GetLanguageByIdRequest> validator = new GetLanguageByIdValidator(); var request = new GetLanguageByIdRequest() { Id = null }; Assert.IsFalse(validator.IsRequestValid(request)); }
public void GetLanguageByIdLanguageValidatorShouldReturnTrueWithValidRequest() { IValidator <GetLanguageByIdRequest> validator = new GetLanguageByIdValidator(); var request = new GetLanguageByIdRequest() { Id = "1" }; Assert.IsTrue(validator.IsRequestValid(request)); }
public void Setup() { AutoMapperConfig.RegisterMappings(); this.context = new MongoContextTestHelper(); this.repo = new LanguageRepository(context); this.request = new GetLanguageByIdRequest(); RemoveAllTestLanguages(); InsertTestLanguage(); this.trueValidator = Substitute.For <IValidator <GetLanguageByIdRequest> >(); trueValidator.IsRequestValid(request).Returns(true); this.falseValidator = Substitute.For <IValidator <GetLanguageByIdRequest> >(); falseValidator.IsRequestValid(request).Returns(false); }
public Language Get([FromUri] GetLanguageByIdRequest request) { //TODO: Handle not found return(getLanguageByIdCommand.Execute(request)); }