public void CanCallWith1ParamAndReturnValue() { var context = new MethodCallTestsContext(); AssertTemplate.Equal( @"Hello #Foo#!", @"Hello @Wrap(""Foo"")!", context); }
public void SingleLineCodeBlock() { AssertTemplate.Equal( @"Bar, Baz", @"@{ var namesForDisplay = string.Join("", "", Names.Where(x => x.StartsWith(""B""))); }@namesForDisplay", new CodeBlockTestsContext() { Names = new string[] { "Foo", "Bar", "Baz" } }); }
public void GetStringProperty() { AssertTemplate.Equal( "Hello FooBar!", "Hello @Name1!", new GetTestsContext() { Name1 = "FooBar", }); }
public void ExpressionsCanBeginWithParen() { AssertTemplate.Equal( "Hello #FooBar#!", "Hello @(Wrap(Name))!", new ExpressionTestsContext() { Name = "FooBar", }); }
public void InlineIfIsIncluded() { AssertTemplate.Equal( @"You are not ready!", @"You are @if(DoIt) {not }ready!", new IfTestsContext() { DoIt = true }); }
public void SingleForEachLoopProducesSingleLine() { AssertTemplate.Equal( @"Hello Foo! Hello Bar! Hello Baz! ", @"@foreach (var name in Names) {Hello @name! }", new ForEachTestsContext() { Names = new string[] { "Foo", "Bar", "Baz" }, }); }
public void CanCallVoidMethod() { var context = new MethodCallTestsContext(); AssertTemplate.Equal( @"Hello!", @"@{ VoidMethod(); }Hello!", context); Assert.Equal(1, context.VoidMethodCallCount); }
public void GetMultipleStringProperties() { AssertTemplate.Equal( "Hello Foo and Bar!", "Hello @Name1 and @Name2!", new GetTestsContext() { Name1 = "Foo", Name2 = "Bar" }); }
public void BlockIfIsExcluded() { AssertTemplate.Equal( @"You are ready!", @"You are @if(DoIt) { not }ready!", new IfTestsContext() { DoIt = false }); }