public void ClearDb() { using (var context = new GuessContext(Options)) { // clear the db context.Transcription.RemoveRange(context.Transcription); context.SaveChanges(); }; }
public void ClearDb() { using (var context = new GuessContext(Options)) { // clear the db context.LeaderBoard.RemoveRange(context.LeaderBoard); context.SaveChanges(); }; }
public void ClearDb() { using (var context = new GuessContext(Options)) { // clear the db context.Video.RemoveRange(context.Video); context.SaveChanges(); }; Url.Url = ""; }
public void SetupDb() { using (var context = new GuessContext(Options)) { // populate the db context.LeaderBoard.Add(LeaderBoards[0]); context.LeaderBoard.Add(LeaderBoards[1]); context.SaveChanges(); } }
public void SetupDb() { using (var context = new GuessContext(Options)) { // populate videos db context.Video.Add(Videos[0]); //context.Video.Add(videos[1]); context.SaveChanges(); } Url.Url = "https://www.youtube.com/watch?v=uIAScvNDQpI"; }
public T Save(T model) { if (model.ID > 0) { GuessContext.Entry(model).State = EntityState.Modified; GuessContext.SaveChanges(); return(model); } Entity.Add(model); GuessContext.SaveChanges(); return(model); }
public async Task TestGetRandomVideo() { using (var context = new GuessContext(Options)) { // Make a new video controller VideosController videosController = new VideosController(context, _mapper); // Get the result of GetRandomVideo method ActionResult <IEnumerable <Video> > result = await videosController.GetRandomVideo(); // Check whether the result is null Assert.IsNotNull(result); } }
public async Task TestGetSuccessfully() { using (var context = new GuessContext(Options)) { // make a new transcription controller TranscriptionsController transcriptionsController = new TranscriptionsController(context); // get the result ActionResult <IEnumerable <Transcription> > result = await transcriptionsController.GetTranscription(); // see if the result is null Assert.IsNotNull(result); } }
public async Task TestPostVideo() { using (var context = new GuessContext(Options)) { // Make a new video controller VideosController videosController = new VideosController(context, _mapper); // Get the result of PostVideo method ActionResult <Video> result = await videosController.PostVideo(Url); // Check whether the result is null Assert.IsNotNull(result); } }
public void SetupDb() { using (var context = new GuessContext(Options)) { // populate the db context.Transcription.Add(Transcriptions[0]); context.Transcription.Add(Transcriptions[1]); // populate videos db //context.Video.Add(videos[0]); //context.Video.Add(videos[1]); context.SaveChanges(); } }
public async Task TestPutTranscriptionNoContentStatusCode() { using (var context = new GuessContext(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)); } }
internal ShoppingCart(GuessContext guessContext) { _guessContext = guessContext; }
public VideoRepository(GuessContext context) { this._context = context; }
public void Remove(T model) { Entity.Remove(model); GuessContext.SaveChanges(); }
public void Remove(long id) { Remove(Get(id)); GuessContext.SaveChanges(); }
public TranscriptionsController(GuessContext context) { _context = context; }
public ProductRepository(GuessContext guessContext) { GuessContext = guessContext; Entity = GuessContext.Set <T>(); }
public OrderRepository(GuessContext appDbContext, ShoppingCart shoppingCart) { _guessContext = appDbContext; _shoppingCart = shoppingCart; }
public VideosController(GuessContext context, IMapper mapper) { _context = context; _mapper = mapper; this._videoRepository = new VideoRepository(new GuessContext()); }