public async Task Translate_GetQueries_Success() { //Arrange GetTranslatesQuery query = new GetTranslatesQuery(); _translateRepository.Setup(x => x.GetListAsync(It.IsAny <Expression <Func <Translate, bool> > >())) .ReturnsAsync(new List <Translate> { new Translate() { Id = 1, Code = "test", LangId = 1, Value = "Deneme" }, new Translate() { Id = 2, Code = "test", LangId = 2, Value = "Test" } }); GetTranslatesQueryHandler handler = new GetTranslatesQueryHandler(_translateRepository.Object, _mediator.Object); //Act var x = await handler.Handle(query, new System.Threading.CancellationToken()); //Asset Assert.That(x.Success, Is.True); Assert.That(((List <Translate>)x.Data).Count, Is.GreaterThan(1)); }
public async Task Translate_GetQueries_Success() { //Arrange var query = new GetTranslatesQuery(); _translateRepository.Setup(x => x.GetListAsync(It.IsAny <Expression <Func <Translate, bool> > >())) .ReturnsAsync(new List <Translate> { new() { Id = 1, Code = "test", LangId = 1, Value = "Deneme" }, new() { Id = 2, Code = "test", LangId = 2, Value = "Test" } });
public async Task <IDataResult <IEnumerable <Translate> > > Handle(GetTranslatesQuery request, CancellationToken cancellationToken) { return(new SuccessDataResult <IEnumerable <Translate> >(await _translateRepository.GetListAsync())); }