Inheritance: ApplicationMeta
        public void Find_By_Name_Return_Object()
        {
            IApplicationRepository applicationRepository = new ApplicationRepository(this.Client, this.Database);

            Application application = new Application(Guid.NewGuid().ToString());
            applicationRepository.Save(application);

            Assert.IsNotNull(applicationRepository.Find(application.Name));
        }
        public void Save()
        {
            IApplicationRepository applicationRepository = new ApplicationRepository(this.Client, this.Database);

            Application application = new Application(Guid.NewGuid().ToString());
            applicationRepository.Save(application);

            Assert.IsNotNull(application.Id);
        }
        public void Remove_Platforms_From_Application()
        {
            IApplicationRepository applicationRepository = new ApplicationRepository(this.Client, this.Database);
            IPlatformRepository iPlatformDAL = new PlatformRepository(this.Client, this.Database);

            Application application = new Application(Guid.NewGuid().ToString());
            application.Platforms = iPlatformDAL.FindAll().ToList();
            applicationRepository.Save(application);

            Application applicationFound = applicationRepository.Find(application.Guid);
            applicationFound.Platforms = new List<Platform>();
            applicationRepository.Update(applicationFound);

            Application applicationRemovedPlatforms = applicationRepository.Find(application.Guid);
            Assert.IsTrue(applicationRemovedPlatforms.Platforms.Count == 0);
        }
        public void Get_All_Applications()
        {
            IApplicationRepository applicationRepository = new ApplicationRepository(this.Client, this.Database);

            Application application1 = new Application(Guid.NewGuid().ToString());
            applicationRepository.Save(application1);

            Application application2 = new Application(Guid.NewGuid().ToString());
            applicationRepository.Save(application2);

            Application application3 = new Application(Guid.NewGuid().ToString());
            applicationRepository.Save(application3);

            IEnumerable<Application> applications = applicationRepository.FindAll();

            Assert.IsNotNull(applications);
        }
        public void Update(Application application)
        {
            try
            {
                var query = Query<Application>.EQ<Guid>(x => x.Guid, application.Guid);
                var update = Update<Application>
                    .Set(x => x.Active, application.Active)
                    .Set(x => x.DateModified, application.DateModified)
                    .Set(x => x.Name, application.Name)
                    .Set(x => x.Platforms, application.Platforms);

                this.GetCollection().Update(query, update);
            }
            catch (Exception ex)
            {
                throw new DataAccessLayerException(ex);
            }
        }
        public void Load_FindApplication_Match()
        {
            IApplicationRepository applicationRepository = new ApplicationRepository(this.client, this.database);

            Application expected = new Application()
            {
                Guid = Guid.NewGuid(),
                Active = true,
                DateCreated = new DateTime(2013, 01, 01),
                DateModified = new DateTime(2013, 01, 01),
                Name = "Testing App",
                Platforms = new List<Platform>()
            };

            this.GetCollection<Application>().Insert(expected);

            Application actual = applicationRepository.Find(expected.Guid);

            expected.ShouldHave().AllProperties().EqualTo(actual);
        }
        public void Save_Platforms_Against_An_Application()
        {
            IApplicationRepository applicationRepository = new ApplicationRepository(this.Client, this.Database);
            IPlatformRepository iPlatformDAL = new PlatformRepository(this.Client, this.Database);

            Application application = new Application(Guid.NewGuid().ToString());
            application.Platforms = iPlatformDAL.FindAll().ToList();
            applicationRepository.Save(application);

            Application applicationFound = applicationRepository.Find(application.Guid);
            Assert.IsNotNull(applicationFound.Platforms);
            Assert.IsTrue(applicationFound.Platforms.Count == application.Platforms.Count);
        }
        public void Update_By_Guid()
        {
            IApplicationRepository applicationRepository = new ApplicationRepository(this.Client, this.Database);

            Application application = new Application(Guid.NewGuid().ToString());
            applicationRepository.Save(application);

            Application applicationLoad = applicationRepository.Find(application.Guid);

            applicationLoad.Active = false;
            applicationLoad.DateModified = DateTime.Now;
            applicationLoad.Name = Guid.NewGuid().ToString();

            applicationRepository.Update(applicationLoad);

            Application applicationUpdated = applicationRepository.Find(application.Guid);

            Assert.IsTrue(applicationUpdated.Active == applicationLoad.Active);
            Assert.IsTrue(applicationUpdated.Name == applicationLoad.Name);
        }
 public void Update(Application application)
 {
     this.applicationRepository.Update(application);
 }
 public void Save(Application application)
 {
     this.applicationRepository.Save(application);
 }