public void ClearDb()
 {
     using (var context = new youtubeContext(options))
     {
         // clear the db
         context.Transcription.RemoveRange(context.Transcription);
         context.SaveChanges();
     };
 }
 public void SetupDb()
 {
     using (var context = new youtubeContext(options))
     {
         // populate the db
         context.Transcription.Add(transcriptions[0]);
         context.Transcription.Add(transcriptions[1]);
         context.SaveChanges();
     }
 }
        public async Task TestGetSuccessfully()
        {
            using (var context = new youtubeContext(options))
            {
                TranscriptionsController transcriptionsController  = new TranscriptionsController(context);
                ActionResult <IEnumerable <Transcription> > result = await transcriptionsController.GetTranscription();

                Assert.IsNotNull(result);
                // i should really check to make sure the exact transcriptions are in there, but that requires an equality comparer,
                // which requires a whole nested class, thanks to C#'s lack of anonymous classes that implement interfaces
            }
        }
        public async Task TestPutTranscriptionNoContentStatusCode()
        {
            using (var context = new youtubeContext(options))
            {
                string        newPhrase      = "this is now a different phrase";
                Transcription transcription1 = context.Transcription.Where(x => x.Phrase == transcriptions[0].Phrase).Single();
                transcription1.Phrase = newPhrase;

                TranscriptionsController transcriptionsController = new TranscriptionsController(context);
                IActionResult            result = await transcriptionsController.PutTranscription(transcription1.TranscriptionId, transcription1) as IActionResult;

                Assert.IsNotNull(result);
                Assert.IsInstanceOfType(result, typeof(NoContentResult));
            }
        }
 public VideoRepository(youtubeContext context)
 {
     this.context = context;
 }
Exemplo n.º 6
0
 public TranscriptionsController(youtubeContext context)
 {
     _context = context;
 }
 public RegisterController(youtubeContext context, IConfiguration configuration)
 {
     _context           = context;
     this.configuration = configuration;
 }
 public CommentsController(youtubeContext context)
 {
     _context = context;
 }
 public UsersController(youtubeContext context)
 {
     _context = context;
 }
Exemplo n.º 10
0
 public LoginController(youtubeContext context)
 {
     _context = context;
 }
Exemplo n.º 11
0
 public VideosController(youtubeContext context, IMapper mapper)
 {
     _context             = context;
     _mapper              = mapper;
     this.videoRepository = new VideoRepository(new youtubeContext());
 }