Beispiel #1
0
        public void Teste_AddOrUpdate()
        {
            // YoutubeEntity
            var video = new YouTube()
            {
                Id          = "a9__D53WsUs",
                Description = "Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 services such as compute, databases, and storage. Learn more: https://amzn.to/33lsybW",
                Title       = "What is AWS?",
                SearchedAt  = DateTime.Now,
                Type        = Domain.Enum.EYoutubeType.Video
            };

            var options = new DbContextOptionsBuilder <SegFyContext>().UseInMemoryDatabase().Options;

            var context = new SegFyContext(options);

            var repository = new YoutubeRepository(context);

            repository.AddOrUpdate(video);

            video.Type = Domain.Enum.EYoutubeType.Canal;

            repository.AddOrUpdate(video);

            var listIds = new List <string>()
            {
                "a9__D53WsUs"
            };

            var items = repository.GetAllByIds(listIds);

            // Assert
            Assert.AreEqual(1, items.Count());
        }
Beispiel #2
0
 public YoutubeService()
 {
     youtubeRepository = new YoutubeRepository();
     youtube           = new YouTubeService(new BaseClientService.Initializer()
     {
         ApiKey = AppConfiguration.YoutubeAPIKey
     });
     LogManager.Configuration = new XmlLoggingConfiguration(AppConfiguration.NLogPath);
     logger = LogManager.GetCurrentClassLogger();
 }