Exemplo n.º 1
0
        public void FromCSV_ToCSV_Roundtrip()
        {
            var alvoOrigem = new Alvo(new Site("asdf"), 1);

            var anuncioOrigem = new Anuncio(alvoOrigem);
            anuncioOrigem.Area = 111;
            anuncioOrigem.Preco = 222;
            anuncioOrigem.Bairro = "zzz";
            anuncioOrigem.TipoImovel = TipoImovel.AP;
            anuncioOrigem.TipoTransacao = TipoTransacao.AL;
            anuncioOrigem.NumeroQuartos = 4;

            var anuncioDestino = Anuncio.FromCSV(anuncioOrigem.ToCSV());

            Assert.AreEqual(anuncioOrigem.Area, anuncioDestino.Area);
            Assert.AreEqual(anuncioOrigem.Preco, anuncioDestino.Preco);
            Assert.AreEqual(anuncioOrigem.Bairro, anuncioDestino.Bairro);
            Assert.AreEqual(anuncioOrigem.TipoImovel, anuncioDestino.TipoImovel);
            Assert.AreEqual(anuncioOrigem.TipoTransacao, anuncioDestino.TipoTransacao);
            Assert.AreEqual(anuncioOrigem.NumeroQuartos, anuncioDestino.NumeroQuartos);

            Assert.IsTrue(anuncioOrigem.Equals(anuncioDestino));
        }
Exemplo n.º 2
0
        public void ToCSV()
        {
            var alvo = new Alvo(new Site("adsf"), 1);
            var anuncio = new Anuncio(alvo);
            anuncio.Area = 123;
            anuncio.Preco = 456;
            anuncio.Bairro = "bairro";
            anuncio.NumeroQuartos = 4;

            string strCSV = anuncio.ToCSV();

            Assert.AreEqual("\"456\",\"123\",\"bairro\",\"adsf\",\"1\",\"NI\",\"NI\",\"4\"",
                strCSV);
        }