public void Genres() { var viewModel = new DetailViewModel(); var genres = viewModel.Genres; Assert.IsNotNull(genres); Assert.IsTrue(genres.Length > 0); }
public void IsEditable() { _ChangedProperties = new List<String>(); var viewModel = new DetailViewModel(); viewModel.PropertyChanged += HandlePropertyChanged; viewModel.IsEditable = true; Assert.IsTrue(viewModel.IsEditable); Assert.IsTrue(_ChangedProperties.Contains("IsEditable")); }
public void LoadMovie() { _ChangedProperties = new List<String>(); var viewModel = new DetailViewModel(); viewModel.PropertyChanged += HandlePropertyChanged; var movie = new Movie(); viewModel.Load(movie); Assert.AreSame(movie, viewModel.Movie); Assert.IsTrue(_ChangedProperties.Contains("Movie")); }
public void Close() { var container = new WindsorContainer(); ComponentContainer.Container = container; var actualViewName = String.Empty; var messageBus = Substitute.For<IMessageBus>(); messageBus .When(bus => bus.Publish<CloseViewMessage>(Arg.Any<CloseViewMessage>())) .Do(arg => actualViewName = ((CloseViewMessage)arg[0]).ViewName); container.Register( Castle.MicroKernel.Registration.Component.For<IMessageBus>().Instance(messageBus)); var movie = new Movie(); var viewModel = new DetailViewModel(); viewModel.Load(movie); viewModel.CloseCommand.Execute(null); messageBus.ReceivedCalls(); Assert.AreEqual(viewModel.Title, actualViewName); }
public void Ratings() { var viewModel = new DetailViewModel(); var ratings = viewModel.Ratings; Assert.IsNotNull(ratings); Assert.IsTrue(ratings.Length > 0); }
public void Title() { var viewModel = new DetailViewModel(); var movie = new Movie(new Random().Next(), Guid.NewGuid().ToString(), Core.Models.Genres.Action, Core.Models.Ratings.G); viewModel.Load(movie); Assert.AreEqual(String.Format("{0} Details", movie.Name), viewModel.Title); }
public void Save() { var container = new WindsorContainer(); ComponentContainer.Container = container; var repository = Substitute.For<IMovieRepository>(); container.Register( Castle.MicroKernel.Registration.Component.For<IMovieRepository>().Instance(repository)); var messageShower = Substitute.For<IMessageShower>(); container.Register( Castle.MicroKernel.Registration.Component.For<IMessageShower>().Instance(messageShower)); var movie = new Movie(); var viewModel = new DetailViewModel(); viewModel.Load(movie); viewModel.SaveCommand.Execute(null); repository.Received().Save(Arg.Is<Movie>(movie)); }