public void Person_Null() { // Arrange var viewModel = new ViewPersonViewModel(); // Act viewModel.Person = null; // Assert Assert.IsNull(viewModel.Person, "Person"); Assert.AreEqual(string.Empty, viewModel.DisplayName, "DisplayName"); }
public void Close() { // Arrange var conductor = Substitute.For<IConductor>(); var viewModel = new ViewPersonViewModel(); viewModel.Parent = conductor; // Act viewModel.Close(); // Assert conductor.Received().CloseItem(viewModel); }
public void Person_NotNull() { // Arrange var viewModel = new ViewPersonViewModel(); var name = Guid.NewGuid().ToString(); var person = new Person { Name = name }; // Act viewModel.Person = person; // Assert Assert.AreSame(person, viewModel.Person, "Person"); Assert.AreEqual(name, viewModel.DisplayName, "DisplayName"); }
public void Handle_ViewPersonMessage() { // Arrange var viewPersonViewModel = new ViewPersonViewModel(); IoC.GetInstance = (type, key) => { return viewPersonViewModel; }; var person = new Person(); var message = new ViewPersonMessage { Person = person }; // Act ViewModel.Handle(message); // Assert Assert.AreSame(person, viewPersonViewModel.Person, "Person"); Assert.AreEqual(1, ViewModel.Items.Count, "Items Count"); Assert.AreSame(viewPersonViewModel, ViewModel.ActiveItem, "ActiveItem"); }