예제 #1
0
        public void LaExpresionDeExpresionContentPuedeIncluirVariablesDeContextoComoFecha()
        {
            // arrange
            var datasource = DatasourceFactory.GetDatasourceSimpleObject();
            var writer     = WriterFactory.MockWriter();

            // act
            var content = new ExpressionContent();

            content.Expression = @"Context.Date.ToString(""dd/MM/yyyy"")";
            content.Write(writer, datasource);

            // assert
            writer.LastWritedText.Should().Be.EqualTo(DateTime.Today.ToString("dd/MM/yyyy"));
        }
예제 #2
0
        public void HayUnContenidoQueEsUnaExpresionEvaluadaSobreElModelo()
        {
            // arrange
            var datasource = DatasourceFactory.GetDatasourceSimpleObject();
            var writer     = WriterFactory.MockWriter();

            // act
            var content = new ExpressionContent();

            content.Expression = "model.Nombre";
            content.Write(writer, datasource);

            // assert
            writer.LastWritedText.Should().Be.EqualTo(datasource.Nombre);
        }