示例#1
0
        public void CreateView_ShouldThrowException_GivenViewModelForNotRegisteredView()
        {
            // Arrange
            var viewRepository = new ViewRepository();
            var viewModel      = new TestViewModel();

            // Act
            // Assert
            Assert.That(() => viewRepository.CreateView(viewModel), Throws.ArgumentException);
        }
示例#2
0
        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>());
        }
示例#3
0
        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>());
        }