Exemplo n.º 1
0
        public void TestGetAddressStringByAddressId()
        {
            Address address = new Address()
            {
                AddressId   = 3,
                CommunityId = 5,
                Location    = "AddressxD"
            };

            Mock <IAddressDao> dao  = new Mock <IAddressDao>(MockBehavior.Loose);
            Task <Address>     res5 = new Task <Address>(() => address);

            res5.RunSynchronously();
            dao.Setup(x => x.FindByIdAsync(It.IsAny <int>())).Returns(res5);

            AddressManager m = new AddressManager(null, null, null, null, dao.Object);
            string         a = m.GetAddressStringByAddressId(1).Result;

            dao.Verify(c => c.FindByIdAsync(It.IsAny <int>()), Times.Once);
        }
        private async void UpdateFields()
        {
            this.Longitude   = SelectedStation.Longitude;
            this.Latitude    = SelectedStation.Latitude;
            this.StationName = SelectedStation.Name;

            try
            {
                this.AddressString = await addressManager.GetAddressStringByAddressId(SelectedStation.AddressId);
            }
            catch (BusinessSqlException ex)
            {
                notifierManager.ShowError(ex.Message);
                return;
            }

            RaisePropertyChanged(nameof(Longitude));
            RaisePropertyChanged(nameof(Latitude));
            RaisePropertyChanged(nameof(StationName));
            RaisePropertyChanged(nameof(AddressString));
        }