Пример #1
0
        public void CallingGetContentByIdReturnsStream()
        {
            var dataAccessMock = new Mock <IImageRepository>();
            var stream         = new MemoryStream();

            stream.WriteByte(1);
            dataAccessMock.Setup(x => x.GetByContentId(It.IsAny <string>())).Returns(stream);
            var controller = new ImagesController(dataAccessMock.Object, null, null);
            var guid       = Guid.NewGuid().ToString();
            var result     = controller.GetContentById(guid);

            //check if its image/jpeg
            Assert.NotNull(result);
        }