Exemplo n.º 1
0
        public void DBServiceAccessOK()
        {
            var db = new DBDummy();

            Assert.IsNull(DatabaseService.GetInstance());

            DatabaseService.RegisterInstance(db);
            Assert.AreSame(db, DatabaseService.GetInstance());

            DatabaseService.ShutdownInstance();
            Assert.IsNull(DatabaseService.GetInstance());

            try
            {
                var fr = DatabaseService.FileRepository;
            }
            catch (InvalidOperationException e)
            {
                if (e.Message == "Database is not specified")
                {
                    return;
                }
            }

            Assert.Fail("Exception \"Database is not specified\" was not thrown");
        }
        public void DBServiceAccessOK()
        {
            var db = new DBDummy();
            Assert.IsNull(DatabaseService.GetInstance());

            DatabaseService.RegisterInstance(db);
            Assert.AreSame(db, DatabaseService.GetInstance());

            DatabaseService.ShutdownInstance();
            Assert.IsNull(DatabaseService.GetInstance());

            try
            {
                var fr = DatabaseService.FileRepository;
            }
            catch(InvalidOperationException e)
            {
                if (e.Message == "Database is not specified")
                {
                    return;
                }
            }

            Assert.Fail("Exception \"Database is not specified\" was not thrown");
        }
        public void RepositoryPropertiesCheck()
        {
            var db = new DBDummy();
            Assert.IsNull(DatabaseService.GetInstance());

            DatabaseService.RegisterInstance(db);

            Assert.IsTrue(DatabaseService.FileRepository is FileRepository);
            Assert.IsTrue(DatabaseService.FavoritesRepository is FavoritesRepository);
            Assert.IsTrue(DatabaseService.FolderRefRepository is FolderRefRepository);

            DatabaseService.ShutdownInstance();
        }
Exemplo n.º 4
0
        public void RepositoryPropertiesCheck()
        {
            var db = new DBDummy();

            Assert.IsNull(DatabaseService.GetInstance());

            DatabaseService.RegisterInstance(db);

            Assert.IsTrue(DatabaseService.FileRepository is FileRepository);
            Assert.IsTrue(DatabaseService.FavoritesRepository is FavoritesRepository);
            Assert.IsTrue(DatabaseService.FolderRefRepository is FolderRefRepository);

            DatabaseService.ShutdownInstance();
        }