Пример #1
0
        public async Task GetByIdTest()
        {
            var actual = await controller.Create(new Video()
            {
                Name = "GetIdVideo", UserId = "1"
            });

            Assert.IsType <CreatedResult>(actual);
            CreatedResult result = actual as CreatedResult;
            var           item   = result.Value as Video;

            var actual2 = await controller.GetById(Guid.Parse(item.Id));

            Assert.IsType <OkObjectResult>(actual2);

            OkObjectResult result2 = actual2 as OkObjectResult;
            var            item2   = result2.Value as Video;

            Assert.Equal(item.Id, item2.Id);
            Assert.Equal("GetIdVideo", item2.Name);
        }