Beispiel #1
0
        public void edit_get_should_return_viewresult_and_model_with_known_values()
        {
            // Arrange
            TextPluginStub plugin = new TextPluginStub();

            plugin.Repository  = _settingsRepository;
            plugin.PluginCache = _siteCache;

            _settingsRepository.SaveTextPluginSettings(plugin);
            _pluginFactory.RegisterTextPlugin(plugin);

            // Act
            ViewResult result = _controller.Edit(plugin.Id) as ViewResult;

            // Assert
            Assert.That(result, Is.Not.Null);
            PluginViewModel model = result.ModelFromActionResult <PluginViewModel>();

            Assert.NotNull(model, "Null model");

            Assert.That(model.Id, Is.EqualTo(plugin.Id));
            Assert.That(model.Name, Is.EqualTo(plugin.Name));
            Assert.That(model.Description, Is.EqualTo(plugin.Description));
        }