예제 #1
0
        public void A_ChangedDevice_modifies_Existing_country_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new MediaRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.SapCode = StringExtension.RandomString(10);
            aggr.MediaMachine.ToList().ForEach(m => m.TimeStamp = DateTimeOffset.Now);
            aggr.MediaServiceLevel.ToList().ForEach(m => m.TimeStamp = DateTimeOffset.Now);
            aggr.MediaDeviceGroup.ToList().ForEach(m => m.Deleted = new Random().Next());

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedMedia).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var service = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, service));
        }
 private MediaRepository CreateRepository(IDatabaseUnitOfWork unitOfWork, out MediaTypeRepository mediaTypeRepository)
 {
     mediaTypeRepository = new MediaTypeRepository(unitOfWork, NullCacheProvider.Current);
     var tagRepository = new TagsRepository(unitOfWork, NullCacheProvider.Current);
     var repository = new MediaRepository(unitOfWork, NullCacheProvider.Current, mediaTypeRepository, tagRepository);
     return repository;
 }
예제 #3
0
        public void CreatePresentation()
        {
            var rep = new MediaRepository();

            var item = Presentation.Create("Test", DateTime.Now, DateTime.MaxValue, 0, "/movies/test.mp4");

            rep.Insert(item);
        }
예제 #4
0
 public UnitOfWork()
 {
     _context = new ModelContainer();
     Media    = new MediaRepository(_context);
     Persons  = new PersonsRepository(_context);
     Events   = new EventsRepository(_context);
     Tags     = new TagsRepository(_context);
 }
예제 #5
0
 public IEmailGroup GetEmailGroupByName(string name)
 {
     var repository = new MediaRepository();
     var media = repository.GetMediaByAliasPath(string.Format("{0}/{1}", EmailGroupFolderAlias, name));
     if (media != null)
         return new EmailGroup(media);
     return null;
 }
예제 #6
0
        private MediaRepository CreateMediaRepository(IScopeUnitOfWork unitOfWork, out IMediaTypeRepository mediaTypeRepository)
        {
            mediaTypeRepository = new MediaTypeRepository(unitOfWork, CacheHelper, Mock.Of <ILogger>(), SqlSyntax);
            var tagRepository = new TagRepository(unitOfWork, CacheHelper, Mock.Of <ILogger>(), SqlSyntax);
            var repository    = new MediaRepository(unitOfWork, CacheHelper, Mock.Of <ILogger>(), SqlSyntax, mediaTypeRepository, tagRepository, Mock.Of <IContentSection>());

            return(repository);
        }
예제 #7
0
 public MediaProcessor(string webFullUrl, MediaConfig config)
 {
     mediaRepository = new MediaRepository(webFullUrl, config.MediaAssetsListName);
     storageManager = AssetStorageFactory.GetStorageManager("Media", webFullUrl);
     videoProcessor = new VideoProcessor(config);
     this.config = config;
     this.webFullUrl = webFullUrl;
 }
        private void CleanupProcessedImages()
        {
            var processedImages = MediaRepository
                                  .GetMany(i => i.State == MediaState.Processed, i => i.Id)
                                  .ToArray();

            MediaService.Delete(processedImages);
            UnitOfWork.Commit();
        }
예제 #9
0
 public UnitOfWork(UdaStoreDbContext context, IHostingEnvironment hostingEnvironment)
 {
     Products        = new ProductRepository(context);
     Users           = new UserRepository(context);
     Categories      = new CategoryRepository(context);
     Mediae          = new MediaRepository(context, hostingEnvironment);
     WidgetInstances = new WidgetInstanceRepository(context);
     _context        = context;
 }
예제 #10
0
        public async Task ResetToDefault()
        {
            Current = await LoadDefault();

            if (Current != null)
            {
                await Save();
            }
        }
예제 #11
0
        public MediaRepositoryTests()
        {
            var connectionString = Configurations.GetConnectionString();

            this.mediaRepository = new MediaRepository(connectionString);
            this.movieRepository = new MovieRepository(connectionString);
            this.dataHelper      = new DataHelper(connectionString);
            ContentApi.Database.DatabaseSetup.Bootstrap(connectionString);
        }
        public string Add([FromForm] string json)
        {
            try {
                this.Request = new Request(json);
                HttpRequest httpRequest = HttpContext.Request;
                int         mediaType   = int.Parse(this.Request.Get("mediaType"));
                Dictionary <String, String> fileData = this.Request.GetValidatedFile(httpRequest, mediaType);

                AbstractMedia media = new AbstractMedia {
                    Name     = this.Request.Get("name"),
                    Album    = new AlbumRepository().FindById(int.Parse(this.Request.Get("album"))),
                    Gender   = new GenderRepository().FindById(int.Parse(this.Request.Get("gender"))),
                    Category = new CategoryRepository().FindById(int.Parse(this.Request.Get("category"))),
                    Size     = fileData["fileSize"],
                    Source   = fileData["fileDestination"]
                };
                int Id = new MediaRepository().Add(media);

                switch (mediaType)
                {
                case 1:     // Musica
                    new MusicRepository().Add(new Music()
                    {
                        Id = Id
                    });
                    break;

                case 2:     // Video
                    new VideoRepository().Add(new Video()
                    {
                        Id = Id
                    });
                    break;

                case 3:     // Libro
                    new BookRepository().Add(new Book()
                    {
                        Id = Id
                    });
                    break;

                case 4:     // Imagen
                    new ImageRepository().Add(new Image()
                    {
                        Id = Id
                    });
                    break;
                }

                return(new Response(true, "Contenido creado exitosamente!").ToJson());
            } catch (NullReferenceException) {
                return(new Response(false, "No se han enviado todos los parametros necesarios para crear el contenido.").ToJson());
            } catch (Exception ex) {
                return(new Response(false, ex.Message).ToJson());
            }
        }
예제 #13
0
        private MediaRepository CreateMediaRepository(IScopeProvider provider, out MediaTypeRepository mediaTypeRepository)
        {
            var accessor      = (IScopeAccessor)provider;
            var tagRepository = new TagRepository(accessor, CacheHelper.Disabled, Logger);

            mediaTypeRepository = new MediaTypeRepository(accessor, CacheHelper.Disabled, Logger);
            var repository = new MediaRepository(accessor, CacheHelper.Disabled, Logger, mediaTypeRepository, tagRepository, Mock.Of <IContentSection>(), Mock.Of <ILanguageRepository>());

            return(repository);
        }
예제 #14
0
        private MediaRepository CreateMediaRepository(IScopeProvider provider, out IMediaTypeRepository mediaTypeRepository)
        {
            var accessor = (IScopeAccessor)provider;

            mediaTypeRepository = new MediaTypeRepository(accessor, AppCaches, Mock.Of <ILogger>());
            var tagRepository = new TagRepository(accessor, AppCaches, Mock.Of <ILogger>());
            var repository    = new MediaRepository(accessor, AppCaches, Mock.Of <ILogger>(), mediaTypeRepository, tagRepository, Mock.Of <ILanguageRepository>());

            return(repository);
        }
 public GenerateHkynXmlPollingAgent(ISettings settings, IEventRepository eventRepository, IEventCustomerRepository eventCustomerRepository, IGenerateKynLipidService kynLipidService,
                                    ICorporateAccountRepository corporateAccountRepository, ILogManager logManager)
 {
     _logger                     = logManager.GetLogger("GenerateHkynXmlPollingAgent");
     _eventRepository            = eventRepository;
     _eventCustomerRepository    = eventCustomerRepository;
     _kynLipidService            = kynLipidService;
     _corporateAccountRepository = corporateAccountRepository;
     _isDevEnvironment           = settings.IsDevEnvironment;
     _mediaRepository            = new MediaRepository(settings);
 }
        public HttpResponseMessage CreateMedia(MediaDto media)
        {
            var mediaRepository = new MediaRepository();
            var result          = mediaRepository.Create(media);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not create Media item at this time, try again later"));
        }
예제 #17
0
        public async void UpdateInfoPlayer(Track track)
        {
            string typeImage = "albums";

            TextBlock_track_name.Text  = track.title;
            TextBlock_artist_name.Text = track.album.artist.name;
            StartTrack();
            track.album.coverImage = await MediaRepository.GetImage(track.album.cover, typeImage);

            image_cover_player.Source = track.album.coverImage;
        }
예제 #18
0
        private MediaRepository CreateRepository(IScopeProvider provider, out MediaTypeRepository mediaTypeRepository, CacheHelper cacheHelper = null)
        {
            cacheHelper = cacheHelper ?? CacheHelper;
            var scopeAccessor = (IScopeAccessor)provider;

            mediaTypeRepository = new MediaTypeRepository(scopeAccessor, cacheHelper, Logger);
            var tagRepository = new TagRepository(scopeAccessor, cacheHelper, Logger);
            var repository    = new MediaRepository(scopeAccessor, cacheHelper, Logger, mediaTypeRepository, tagRepository, Mock.Of <IContentSection>(), Mock.Of <ILanguageRepository>());

            return(repository);
        }
예제 #19
0
        private MediaRepository CreateRepository(IScopeProvider provider, out MediaTypeRepository mediaTypeRepository, AppCaches appCaches = null)
        {
            appCaches = appCaches ?? AppCaches;
            var scopeAccessor = (IScopeAccessor)provider;

            mediaTypeRepository = new MediaTypeRepository(scopeAccessor, appCaches, Logger);
            var tagRepository = new TagRepository(scopeAccessor, appCaches, Logger);
            var repository    = new MediaRepository(scopeAccessor, appCaches, Logger, mediaTypeRepository, tagRepository, Mock.Of <ILanguageRepository>());

            return(repository);
        }
예제 #20
0
        public MediaControllerTests()
        {
            var connectionString = Configurations.GetConnectionString();

            Environment.SetEnvironmentVariable("CONNECTION_STRING", connectionString);
            var server = new TestServer(Program.CreateWebHostBuilder());

            this.apiClient       = server.CreateClient();
            this.data            = new DataHelper(connectionString);
            this.mediaRepository = new MediaRepository(connectionString);
            this.movieRepository = new MovieRepository(connectionString);
        }
예제 #21
0
        private MediaRepository CreateMediaRepository(IScopeProvider provider, out IMediaTypeRepository mediaTypeRepository)
        {
            var accessor           = (IScopeAccessor)provider;
            var templateRepository = new TemplateRepository(accessor, AppCaches.Disabled, Logger, TestObjects.GetFileSystemsMock());
            var commonRepository   = new ContentTypeCommonRepository(accessor, templateRepository, AppCaches);

            mediaTypeRepository = new MediaTypeRepository(accessor, AppCaches, Mock.Of <ILogger>(), commonRepository);
            var tagRepository = new TagRepository(accessor, AppCaches, Mock.Of <ILogger>());
            var repository    = new MediaRepository(accessor, AppCaches, Mock.Of <ILogger>(), mediaTypeRepository, tagRepository, Mock.Of <ILanguageRepository>());

            return(repository);
        }
예제 #22
0
        public ParseHkynPdfPollingAgent(ISettings settings, IEventRepository eventRepository, IEventCustomerResultRepository eventCustomerResultRepository, ILogManager logManager)
        {
            _logger          = logManager.GetLogger("ParseHkynPdfPollingAgent");
            _logManager      = logManager;
            _eventRepository = eventRepository;
            _eventCustomerResultRepository = eventCustomerResultRepository;


            _isDevEnvironment = settings.IsDevEnvironment;
            _hkynParsePdfPath = settings.HkynParsePdfPath;
            _mediaRepository  = new MediaRepository(settings);
        }
예제 #23
0
        // GET: Play
        public ActionResult Index(int MediaId, string UserId)
        {
            UsuarioRepository     usuarioRepository     = new UsuarioRepository(context);
            MediaOnPlayRepository mediaonplayRepository = new MediaOnPlayRepository(context);
            Usuario              usuario     = usuarioRepository.Query(u => u.IdentityId == UserId).FirstOrDefault();
            MediaOnPlay          mediaOnPlay = mediaonplayRepository.Query(m => m.MediaId == MediaId && m.UsuarioId == usuario.Id).FirstOrDefault();
            MediaOnPlayViewModel model;

            // Si el usuario no existe.
            if (usuario == null)
            {
                ViewBag.Error = 1;
                return(View());
            }

            // Si el usuario nunca ha visto la pelicula o serie.
            if (mediaOnPlay == null)
            {
                MediaRepository mediaRepository = new MediaRepository(context);
                var             media           = mediaRepository.Query(m => m.id == MediaId && m.estado != EEstatusMedia.ELIMINADO && m.estado != EEstatusMedia.INVISIBLE).FirstOrDefault();
                // Si la pelicula o serie que desea ver no esta disponible.
                if (media == null)
                {
                    ViewBag.Error = 2;
                    return(View());
                }
                mediaOnPlay = new MediaOnPlay {
                    Milisegundo = 0,
                    Media       = media,
                    MediaId     = media.id,
                    Usuario     = usuario,
                    UsuarioId   = usuario.Id
                };
                mediaonplayRepository.Insert(mediaOnPlay);

                context.SaveChanges();

                model = MapHelper.Map <MediaOnPlayViewModel>(mediaOnPlay);
            }

            else
            {
                // Se recarga la entidad.
                context.Entry(mediaOnPlay).Reference(m => m.Usuario).Load();
                context.Entry(mediaOnPlay).Reference(m => m.Media).Load();

                model = MapHelper.Map <MediaOnPlayViewModel>(mediaOnPlay);
            }

            ViewBag.Title = "Reproduciendo: " + mediaOnPlay.Media.nombre;
            return(View(model));
        }
예제 #24
0
        public void Delete_NonExisting_ExceptionThrown()
        {
            MediaRepository Repository = new MediaRepository(helper);
            Media media = new Media()
            {
                ID = Guid.NewGuid(),
                MediaData = "Update",
                RelationID = this.TestMedia2.RelationID
            };

            Repository.Delete(media);
            Assert.IsNull(Repository.GetByID(media.ID));
        }
예제 #25
0
        private MediaRepository CreateRepository(IScopeProvider provider, out MediaTypeRepository mediaTypeRepository, AppCaches appCaches = null)
        {
            appCaches = appCaches ?? AppCaches;
            var scopeAccessor = (IScopeAccessor)provider;

            var templateRepository = new TemplateRepository(scopeAccessor, appCaches, Logger, TestObjects.GetFileSystemsMock());
            var commonRepository   = new ContentTypeCommonRepository(scopeAccessor, templateRepository, appCaches);

            mediaTypeRepository = new MediaTypeRepository(scopeAccessor, appCaches, Logger, commonRepository);
            var tagRepository = new TagRepository(scopeAccessor, appCaches, Logger);
            var repository    = new MediaRepository(scopeAccessor, appCaches, Logger, mediaTypeRepository, tagRepository, Mock.Of <ILanguageRepository>());

            return(repository);
        }
예제 #26
0
        public void AddMedia_NullMediaProvided_ThrowArgumentNullException()
        {
            var connectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MediaLibrary;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";

            using (var connection = new SqlConnection(connectionString))
            {
                //ARRANGE
                var repository = new MediaRepository(connection);

                //ACT
                //ASSERT
                Assert.ThrowsException <ArgumentNullException>(() => repository.Insert(null));
            }
        }
예제 #27
0
 public MediaModel(UserManager <Employee> userManager,
                   RoleManager <EmployeeRole> roleManager,
                   MediaRepository mediaEntries,
                   ImageRepository images,
                   DocumentRepository documents,
                   ISettings settings)
 {
     this.userManager  = userManager;
     this.roleManager  = roleManager;
     this.mediaEntries = mediaEntries;
     this.settings     = settings;
     this.images       = images;
     this.documents    = documents;
 }
        public HttpResponseMessage LendMediaItem(LentMediaDto lentMedia)
        {
            var mediaRepository = new MediaRepository();
            var getSingleItem   = mediaRepository.GetSingleItem(lentMedia.MediaId);

            lentMedia.MediaConditionId = getSingleItem.MediaConditionId;
            var lentMediaRepository = new LentMediaRepository();
            var lendMedia           = lentMediaRepository.LendMedia(lentMedia);

            if (lendMedia)
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not lend Media item at this time, try again later"));
        }
예제 #29
0
        //For this test, check whether the database contains at least one row before running
        public void DeleteMedia_CorrectMediaIdProvided_ReturnTrue()
        {
            var connectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MediaLibrary;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";

            using (var connection = new SqlConnection(connectionString))
            {
                //ARRANGE
                var repository = new MediaRepository(connection);
                var media      = repository.GetAll().Last();
                //ACT
                var result = repository.Delete(media.Id);
                //ASSERT
                Assert.IsTrue(result);
            }
        }
예제 #30
0
 public async Task Initialize(bool resetToDefault = false)
 {
     if (resetToDefault)
     {
         Reset();
     }
     else
     {
         Current = await Load();
     }
     if (Current == null)
     {
         await ResetToDefault();
     }
 }
예제 #31
0
        public void GetAllMedias_ReturnAllMedias()
        {
            var connectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MediaLibrary;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";

            using (var connection = new SqlConnection(connectionString))
            {
                //ARRANGE
                var repository = new MediaRepository(connection);
                //ACT
                var result = repository.GetAll();
                //ASSERT
                Assert.IsNotNull(result);
                Assert.AreNotEqual(0, result.Count());
            }
        }
        public HttpResponseMessage SellMediaItem(SoldMediaDto soldMedia)
        {
            var mediaRepository = new MediaRepository();
            var getSingleItem   = mediaRepository.GetSingleItem(soldMedia.MediaId);

            soldMedia.MediaConditionId = getSingleItem.MediaConditionId;
            var soldMediaRepository = new SoldMediaRepository();
            var sellMedia           = soldMediaRepository.SellMedia(soldMedia);

            if (sellMedia)
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not sell Media item at this time, try again later"));
        }
예제 #33
0
        public async Task <IActionResult> Search(string query)
        {
            try
            {
                var repo    = new MediaRepository(_context);
                var results = await repo.SearchMediaAsync(query);

                ViewBag.Query = query;
                return(View("Index", results));
            }
            catch (Exception ex) when(ex is InvalidCastException || ex is DbException)
            {
                ViewBag.DBError = ex.Message;
                return(View("Index", new List <Media>()));
            }
        }
예제 #34
0
        public void GetByIDMedia_CorrectMediaIdProvided_ReturnMediaRetrieved()
        {
            var connectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MediaLibrary;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";

            using (var connection = new SqlConnection(connectionString))
            {
                //ARRANGE
                var repository = new MediaRepository(connection);
                var firstMedia = repository.GetAll().FirstOrDefault();
                //ACT
                var result = repository.GetById(firstMedia.Id);
                //ASSERT
                Assert.IsNotNull(result);
                Assert.AreEqual(firstMedia.Id, result.Id);
            }
        }
예제 #35
0
 public void A_RegisteredMedia_creates_a_new_media_in_the_database()
 {
     var bootStrapper = new BootStrapper();
     bootStrapper.StartServices();
     var serviceEvents = bootStrapper.GetService<IServiceEvents>();
     //1.- Create message
     var aggr = GenerateRandomAggregate();
     var message = GenerateMessage(aggr);
     //2.- Emit message
     serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });
     //3.- Load the saved country
     var repository = new MediaRepository(_configuration.TestServer);
     var service = repository.Get(aggr.Id);
     //4.- Check equality
     Assert.True(ObjectExtension.AreEqual(aggr, service));
 }
예제 #36
0
        public void CacheActiveForIntsAndGuids()
        {
            var realCache = new AppCaches(
                new ObjectCacheAppCache(),
                new DictionaryAppCache(),
                new IsolatedCaches(t => new ObjectCacheAppCache()));

            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MediaRepository repository = CreateRepository(provider, out MediaTypeRepository mediaTypeRepository, appCaches: realCache);

                IUmbracoDatabase udb = ScopeAccessor.AmbientScope.Database;

                udb.EnableSqlCount = false;

                MediaType mediaType = MediaTypeBuilder.CreateSimpleMediaType("umbTextpage1", "Textpage");
                mediaTypeRepository.Save(mediaType);

                Media media = MediaBuilder.CreateSimpleMedia(mediaType, "hello", -1);
                repository.Save(media);

                udb.EnableSqlCount = true;

                // go get it, this should already be cached since the default repository key is the INT
                IMedia found = repository.Get(media.Id);
                Assert.AreEqual(0, udb.SqlCount);

                // retrieve again, this should use cache
                found = repository.Get(media.Id);
                Assert.AreEqual(0, udb.SqlCount);

                // reset counter
                udb.EnableSqlCount = false;
                udb.EnableSqlCount = true;

                // now get by GUID, this won't be cached yet because the default repo key is not a GUID
                found = repository.Get(media.Key);
                int sqlCount = udb.SqlCount;
                Assert.Greater(sqlCount, 0);

                // retrieve again, this should use cache now
                found = repository.Get(media.Key);
                Assert.AreEqual(sqlCount, udb.SqlCount);
            }
        }
예제 #37
0
        public void A_UnregisteredDevice_modifies_Existing_country_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new MediaRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //2.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(UnregisteredMedia).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            var service = repository.Get(aggr.Id);
            Assert.Null(service);
        }
예제 #38
0
        public void GivenAStoredImage_WhenTheImageUrlIsConstructed_ThenTheImageIsReturned()
        {
            var logger = new Mock<ILogger>();
            string connectionString = ConfigurationManager.ConnectionStrings["mblog"].ConnectionString;
            string key = "filename";
            IUserService userService = new UserService(new UserRepository(connectionString),
                                                       new UsernameBlacklistRepository(connectionString), 
                                                       logger.Object);
            User user = userService.CreateUser("name", "email", "password");

            IMediaRepository repository = new MediaRepository(connectionString);
            IMediaService mediaService = new MediaService(repository);
            var controller = new MediaController(mediaService, logger.Object);

            var stream = new MemoryStream(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0});

            mediaService.WriteMedia(key, user.Id, "image/png", stream, 10);

            ActionResult result = controller.Show(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, key);
            Assert.That(result, Is.Not.Null);
        }
예제 #39
0
 public void GetByID_ExistingEntity_Retrieved()
 {
     MediaRepository Repository = new MediaRepository(helper);
     Assert.AreEqual(this.TestMedia.ID, Repository.GetByID(this.TestMedia.ID).ID);
 }
예제 #40
0
 public void GetByID_NonExistingEntity_Null()
 {
     MediaRepository Repository = new MediaRepository(helper);
     Assert.AreEqual(null, Repository.GetByID(Guid.NewGuid()));
 }
예제 #41
0
 public void Insert_ExistingEntity_ExceptiontThrown()
 {
     MediaRepository Repository = new MediaRepository(helper);
     Repository.Insert(this.TestMedia2);
 }
예제 #42
0
 public void Insert_InvalidEntity_ExceptionThrown()
 {
     MediaRepository Repository = new MediaRepository(helper);
     this.TestMedia2.MediaData = "InvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidData";
     Repository.Insert(TestMedia2);
 }
예제 #43
0
 public void Insert_NullEntity_ExceptionThrown()
 {
     MediaRepository Repository = new MediaRepository(helper);
     Repository.Insert(null);
 }
예제 #44
0
        public void Update_ExistingEntity_Updated()
        {
            MediaRepository Repository = new MediaRepository(helper);

            Random rand = new Random();
            this.TestMedia2.MediaData = rand.NextDouble().ToString();
            Repository.Update(this.TestMedia2, false);

            Assert.AreEqual(this.TestMedia2.MediaData, Repository.GetByID(this.TestMedia2.ID).MediaData);
        }
예제 #45
0
 public void Update_InvalidEntity_ExceptionThrown()
 {
     MediaRepository Repository = new MediaRepository(helper);
     this.TestMedia2.MediaData = "InvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidDataInvalidData";
     Repository.Update(TestMedia2, false);
 }
예제 #46
0
        public void Update_NonExistingEntity_Saved()
        {
            MediaRepository Repository = new MediaRepository(helper);

            Media media = new Media()
            {
                ID = Guid.NewGuid(),
                MediaData = "Update",
                RelationID = this.TestMedia2.RelationID
            };

            Repository.Update(media, false);

            Assert.AreEqual(media.ID, Repository.GetByID(media.ID).ID);
        }
예제 #47
0
 public void Update_NullEntity_ExceptionThrown()
 {
     MediaRepository Repository = new MediaRepository(helper);
     Repository.Update(null, false);
 }
예제 #48
0
 public void Delete_NullEntity_ExceptionThrown()
 {
     MediaRepository Repository = new MediaRepository(helper);
     Repository.Delete(null);
 }