예제 #1
0
        public void MethodTestGravaDados()
        {
            string path = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));

            path = path.Replace("\\UnitTestProjeto\\bin", "");
            string strNameFile       = path + "\\ArquivoDados.txt";
            string strNameFileIndice = path + "\\ArquivoIndice.txt";

            List <ITweet> listaTweets = new List <ITweet>();
            Tweets        tweets      = new Tweets();

            listaTweets.AddRange(tweets.BuscarTweets("", "", "", "", "#RockBand"));

            Principal p = new Principal();

            p.strNameFile       = strNameFile;
            p.strNameFileIndice = strNameFileIndice;
            p.GravarDados(listaTweets);
            BinarySearchAlgorithm bsa    = new BinarySearchAlgorithm();
            StrFileIndice         objeto = new StrFileIndice();

            if (bsa.BinarySearchById(1170023482421325824, strNameFileIndice, ref objeto))
            {
                Assert.AreEqual(1170023482421325824, objeto.Id);
            }
        }
예제 #2
0
        public void MethodTestBinarySearch()
        {
            string path = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));

            path = path.Replace("\\UnitTestProjeto\\bin", "");
            string strNameFileIndice     = path + "\\ArquivoIndice.txt";
            BinarySearchAlgorithm bsa    = new BinarySearchAlgorithm();
            StrFileIndice         objeto = new StrFileIndice();

            if (bsa.BinarySearchById(1170023482421325824, strNameFileIndice, ref objeto))
            {
                Assert.AreEqual(1170023482421325824, objeto.Id);
            }
        }
예제 #3
0
        public void MethodTestEnderecoIndice()
        {
            string path = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));

            path = path.Replace("\\UnitTestProjeto\\bin", "");
            string strNameFile       = path + "\\ArquivoDados.txt";
            string strNameFileIndice = path + "\\ArquivoIndice.txt";

            BinarySearchAlgorithm bsa    = new BinarySearchAlgorithm();
            StrFileIndice         objeto = new StrFileIndice();

            if (bsa.BinarySearchById(1170023482421325824, strNameFileIndice, ref objeto))
            {
                FileStream fsDados = new FileStream(strNameFile, FileMode.Open);
                fsDados.Seek(objeto.Posicao, SeekOrigin.Begin);
                StrFile oReturn = bsa.GetFileValue <StrFile>(fsDados);
                Assert.AreEqual(1170023482421325824, oReturn.Id);

                fsDados.Close();
                fsDados.Dispose();
            }
        }