public void GetPropertyTraceModelFilter()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);
            var exp = realEstate.GetAllPropertyTraceViewAsync(0);

            Assert.IsTrue(exp.GetAsyncEnumerator().Current == null);
        }
        public async Task UpdatePriceDefault()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);

            await CreateNewBuildingPropertyTest();

            Assert.IsTrue(await realEstate.UpdatePricePropertyAsync(1, 20000));
        }
        public void CreateNewBuildingPropertyTestWithoutOwnerId()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);
            var property = new PropertyModelView {
                Address = "AddressTest", CodeInternal = "Code", IdOwner = 0, IdProperty = 1, Name = "NameTest", Price = 2540, Year = 2015
            };

            Assert.ThrowsAsync <Exception>(async() => await realEstate.CreatePropertyBuildingAsync(property));
        }
        public async Task CreateNewPropertyTraceTestDefault()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);
            var property = new PropertyTraceModelView {
                DateSale = DateTime.Now, IdProperty = -1, Name = "Test Name", Tax = 20, Value = 20000
            };
            var result = await realEstate.CreatePropertyTraceAsync(property);

            Assert.IsTrue(result > 0);
        }
        public async Task CreateNewBuildingPropertyTestCreateDefaultOwner()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);
            var property = new PropertyModelView {
                Address = "AddressTest", CodeInternal = "Code", IdOwner = -1, IdProperty = 1, Name = "NameTest", Price = 2540, Year = 2015
            };
            var result = await realEstate.CreatePropertyBuildingAsync(property);

            Assert.IsTrue(result > 0);
        }
        public async Task AddImagePropertyTest()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);
            var fileStream = System.IO.File.OpenRead(@"TestImage\descargar.png");
            var property   = new ImagePropertyModelView {
                IdProperty = 1, File = new FormFile(fileStream, 0, fileStream.Length, "descargar", "descargar.png")
            };
            var result = await realEstate.AddImageProperty(property);

            fileStream.Close();
            Assert.IsTrue(result > 0);
        }
        public void UpdatePricePropertyDoesNotExist()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);

            Assert.ThrowsAsync <Exception>(async() => await realEstate.UpdatePricePropertyAsync(0, 2000));
        }
        public void GetImageIdPropertyNotFound()
        {
            RealEstateXPOServices realEstate = new RealEstateXPOServices(_uow);

            Assert.ThrowsAsync <Exception>(async() => await realEstate.GetImagePropertyAsync(0));
        }