public void OnNavigatedTo_SetsGardenBedToNull_WhenIdMissing()
 {
     //Arrange
     _viewModel           = new DetailViewModel(_navMock.Object, _serviceMock.Object);
     _viewModel.GardenBed = new GardenBed();
     //Act
     _viewModel.OnNavigatedTo(new NavigationParameters());
     //Verify
     Assert.IsNull(_viewModel.GardenBed);
 }
 public void OnNavigatedTo_SetsGardenBedToNull_WhenIdWrongFormat()
 {
     //Arrange
     _viewModel           = new DetailViewModel(_navMock.Object, _serviceMock.Object);
     _viewModel.GardenBed = new GardenBed();
     //Act
     _viewModel.OnNavigatedTo(new NavigationParameters {
         ["id"] = new object()
     });
     //Verify
     Assert.IsNull(_viewModel.GardenBed);
 }
 public void OnNavigatedTo_SetsLoadingToFalse_WhenReady()
 {
     //Arrange
     _viewModel = new DetailViewModel(_navMock.Object, _serviceMock.Object)
     {
         Loading = true
     };
     //Act
     _viewModel.OnNavigatedTo(new NavigationParameters {
         ["id"] = new object()
     });
     //Verify
     Assert.IsFalse(_viewModel.Loading);
 }
        public void OnNavigatedTo_LoadsGardenBed_WithGivenId()
        {
            //Arrange
            var testData = new GardenBed {
                Id = 5
            };

            _serviceMock
            .Setup(s => s.GetGardenBed(It.Is <int>(x => x == 5)))
            .Returns(Task.Factory.StartNew(() => testData))
            .Verifiable();
            _viewModel = new DetailViewModel(_navMock.Object, _serviceMock.Object);
            //Act
            _viewModel.OnNavigatedTo(new NavigationParameters {
                ["id"] = "5"
            });
            //Verify
            Assert.AreSame(testData, _viewModel.GardenBed);
        }