public void ShouldReturnResultOfTransformerWrappedInAnHtmlView()
        {
            Hashtable context = new Hashtable();

            context["foo"] = "bar";

            velocityTransformerMock.ExpectAndReturn("Transform", "transformed", "myTemplate", new HashtableConstraint(context));

            // Execute
            HtmlFragmentResponse response = viewGenerator.GenerateView("myTemplate", context);

            // Verify
            Assert.AreEqual("transformed", ((HtmlFragmentResponse)response).ResponseFragment);
            VerifyAll();
        }
Exemplo n.º 2
0
        public void ShouldReturnResultOfTransformerWrappedInAnHtmlView()
        {
            Hashtable context = new Hashtable();

            context["foo"] = "bar";

            velocityTransformerMock.Setup(transformer => transformer.Transform("myTemplate", It.Is <Hashtable>(t => t.Count == 1 && (string)t["foo"] == "bar"))).Returns("transformed").Verifiable();

            // Execute
            HtmlFragmentResponse response = viewGenerator.GenerateView("myTemplate", context);

            // Verify
            Assert.AreEqual("transformed", ((HtmlFragmentResponse)response).ResponseFragment);
            VerifyAll();
        }