public void AddVideo()
        {
            var options = new DbContextOptionsBuilder <BetterCalmContext>()
                          .UseInMemoryDatabase(databaseName: "MSP.BetterCalmDatabase").Options;
            var context = new BetterCalmContext(options);

            context.Add(listVideo[0]);
            context.SaveChanges();
            repository = new VideoRepository(context);
            var initial = repository.GetAll().Count();

            repository.Add(listVideo[1]);
            var final = repository.GetAll().Count();

            context.Database.EnsureDeleted();

            Assert.AreEqual(initial + 1, final);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                VideoRepository videoRepository = new VideoRepository();
                List <Video>    AllVideos       = videoRepository.GetAll();

                foreach (Video video in AllVideos)
                {
                    tblVideos.Rows.Add(addVideoTableRow(video));
                }
            }
        }
Exemplo n.º 3
0
 public IHttpActionResult Get()
 {
     return(Ok(videoRepo.GetAll()));
 }
Exemplo n.º 4
0
 // GET: Video
 public ActionResult Index()
 {
     return(View(repository.GetAll()));
 }
Exemplo n.º 5
0
 public HttpResponseMessage GetAllVideo()
 {
     return(Request.CreateResponse(HttpStatusCode.OK, video.GetAll()));
 }