public async Task Handle(Conteudo esperado, [Frozen] ICollection <Conteudo> conteudos, GetHandler subject) { // Arrange conteudos.Add(esperado); // Act var result = await subject.Handle(new Get { Id = esperado.Id }, default); // Assert result.Should().BeEquivalentTo(esperado); }
public HttpResponseMessage Get(int id) { var handler = new GetHandler(); var response = handler.Handle(id); if (handler.Errors == null || handler.Errors.Count < 1) { return(Request.CreateResponse(HttpStatusCode.OK, response.ReportComponentDtos[0])); } return(Request.CreateResponse(HttpStatusCode.BadRequest, handler.Errors)); }
public async Task Handle_ChangesWatched([Frozen] ICollection <Conteudo> conteudos, GetHandler subject) { // Arrange conteudos.Add(new Conteudo { Id = 1, Watched = false }); // Act var result = await subject.Handle(new Get { Id = 1 }, default); // Assert result.Should() .BeOfType <Conteudo>() .Which.Watched.Should() .BeTrue(); }