Exemple #1
0
        public void TestTappedIconTypeIconLink()
        {
            // set up
            var description = new WeatherIconDescription
            {
                Name    = "Windy",
                Type    = WeatherIconDescription.IconType.IconLink,
                WebLink = "https://localhost/test/123/"
            };

            // run
            var viewModel = new WeatherIconViewModel(null, description);

            Assert.IsTrue(viewModel.Tapped.CanExecute(null), "command must be able to executed");

            viewModel.Tapped.Execute(null);

            // can't check result
        }
Exemple #2
0
        public void TestTappedIconTypeIconApp()
        {
            // set up
            var description = new WeatherIconDescription
            {
                Name    = "Windy",
                Type    = WeatherIconDescription.IconType.IconApp,
                WebLink = "com.windyty.android"
            };

            // run
            var viewModel = new WeatherIconViewModel(null, description);

            Assert.IsTrue(viewModel.Tapped.CanExecute(null), "command must be able to executed");

            viewModel.Tapped.Execute(null);

            // check
            var appManager = DependencyService.Get <IAppManager>() as UnitTestAppManager;

            Assert.IsTrue(appManager.AppHasBeenOpened, "app must have been opened");
        }
Exemple #3
0
        public void TestDefaultCtor()
        {
            // set up
            var description = new WeatherIconDescription
            {
                Name    = "Windy",
                Type    = WeatherIconDescription.IconType.IconApp,
                WebLink = "com.windyty.android"
            };

            // run
            var viewModel = new WeatherIconViewModel(null, description);

            ////Assert.IsTrue(
            ////    viewModel.WaitForPropertyChange(
            ////        nameof(viewModel.Icon),
            ////        TimeSpan.FromSeconds(10)),
            ////    "waiting for property change must succeed");

            // check
            Assert.AreEqual(description.Name, viewModel.Title, "title must match name of description");
            ////Assert.IsNotNull(viewModel.Icon, "icon image source must not be null");
            Assert.IsNotNull(viewModel.Tapped, "Tapped command must not be null");
        }
        /// <summary>
        /// Creates a new weather icon instance
        /// </summary>
        /// <param name="iconDescription">weather icon description</param>
        public WeatherIcon(WeatherIconDescription iconDescription)
        {
            this.BindingContext = this.viewModel = new WeatherIconViewModel(iconDescription);

            this.InitializeComponent();
        }