public void CreateView_ShouldThrowException_GivenViewModelForNotRegisteredView() { // Arrange var viewRepository = new ViewRepository(); var viewModel = new TestViewModel(); // Act // Assert Assert.That(() => viewRepository.CreateView(viewModel), Throws.ArgumentException); }
public void RegisterViewsFromCurrentlyLoadedAssemblies_ShouldRegisterViewsWithAttribute() { // Arrange var viewRepository = new ViewRepository(); // Act viewRepository.RegisterViewsFromCurrentlyLoadedAssemblies(); // Assert var viewModel = new TestViewModel(); var view = viewRepository.CreateView(viewModel); Assert.That(view, Is.Not.Null); Assert.That(view, Is.TypeOf <AttributedTestView>()); }
public void CreateView_ShouldCreateViewRegisteredForGivenViewModel() { // Arrange var viewRepository = new ViewRepository(); viewRepository.RegisterView(typeof(TestView), typeof(TestViewModel)); var viewModel = new TestViewModel(); // Act var view = viewRepository.CreateView(viewModel); // Assert Assert.That(view, Is.Not.Null); Assert.That(view, Is.TypeOf <TestView>()); }