public void StrictNullUsesException()
 {
     var compiler = new CSharpViewCompiler()
                    {
                        BaseClass = "Spark.Tests.Stubs.StubSparkView",
                        NullBehaviour = NullBehaviour.Strict
                    };
     var chunks = new Chunk[]
                  {
                      new ViewDataChunk { Name="comment", Type="Spark.Tests.Models.Comment"},
                      new SendExpressionChunk {Code = "comment.Text", SilentNulls = false}
                  };
     compiler.CompileView(new[] { chunks }, new[] { chunks });
     Assert.That(compiler.SourceCode.Contains("catch(System.NullReferenceException ex)"));
     Assert.That(compiler.SourceCode.Contains("ArgumentNullException("));
     Assert.That(compiler.SourceCode.Contains(", ex);"));
 }
 public void LenientSilentNullDoesNotCauseWarningCS0168()
 {
     var compiler = new CSharpViewCompiler()
                    {
                        BaseClass = "Spark.Tests.Stubs.StubSparkView",
                        NullBehaviour = NullBehaviour.Lenient
                    };
     var chunks = new Chunk[]
                  {
                      new ViewDataChunk { Name="comment", Type="Spark.Tests.Models.Comment"},
                      new SendExpressionChunk {Code = "comment.Text", SilentNulls = true}
                  };
     compiler.CompileView(new[] { chunks }, new[] { chunks });
     Assert.That(compiler.SourceCode.Contains("catch(System.NullReferenceException)"));
 }