示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        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();
        }