本文整理汇总了C#中Nancy.Tests.Unit.ViewEngines.FakeModel类的典型用法代码示例。如果您正苦于以下问题:C# FakeModel类的具体用法?C# FakeModel怎么用?C# FakeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FakeModel类属于Nancy.Tests.Unit.ViewEngines命名空间,在下文中一共展示了FakeModel类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_render_block_when_ifnot_statement_returns_false
public void Should_render_block_when_ifnot_statement_returns_false()
{
const string input = @"<html><head></head><body>@IfNot.HasUsers;<p>No users found!</p>@EndIf;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
var model = new FakeModel("Nancy", new List<string>());
var output = viewEngine.Render(input, model, this.fakeHost);
Assert.Equal(@"<html><head></head><body><p>No users found!</p><ul></ul></body></html>", output);
}
示例2: Should_render_block_when_if_statement_returns_true
public void Should_render_block_when_if_statement_returns_true()
{
const string input = @"<html><head></head><body>@If.HasUsers;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf;</body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });
var output = viewEngine.Render(input, model, this.fakeHost);
Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
}
示例3: Should_allow_if_and_endif_without_semi_colon
public void Should_allow_if_and_endif_without_semi_colon()
{
const string input = @"<html><head></head><body>@If.HasUsers<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf</body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });
var output = viewEngine.Render(input, model, this.fakeHost);
Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
}
示例4: Should_allow_substitutions_to_work_with_standard_objects
public void Should_allow_substitutions_to_work_with_standard_objects()
{
const string input = @"<html><head></head><body><ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });
var output = viewEngine.Render(input, model, this.fakeHost);
Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
}
示例5: Should_support_each_block_with_model_as_model_source
public void Should_support_each_block_with_model_as_model_source()
{
const string input = @"<html><head></head><body><ul>@Each.Model.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });
((FakeViewEngineHost)this.fakeHost).Context = new FakeModel("NancyContext", new List<string>());
var output = viewEngine.Render(input, model, this.fakeHost);
Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
}
示例6: Should_allow_if_and_endif_and_model_model_source
public void Should_allow_if_and_endif_and_model_model_source()
{
const string input = @"<html><head></head><body>@If.Model.HasUsers;Users [email protected]</body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });
((FakeViewEngineHost)this.fakeHost).Context = new FakeModel("NancyContext", new List<string>());
var output = viewEngine.Render(input, model, this.fakeHost);
Assert.Equal(@"<html><head></head><body>Users found!</body></html>", output);
}
示例7: Should_stuffrender_block_when_ifnot_statement_returns_false
public void Should_stuffrender_block_when_ifnot_statement_returns_false()
{
const string input = @"<html><head></head><body>@IfNot.Context.HasUsers;<p>No users found!</p>@EndIf;</body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Nancy " });
((FakeViewEngineHost)this.fakeHost).Context = new FakeModel("NancyContext", new List<string>());
var output = viewEngine.Render(input, model, this.fakeHost);
Assert.Equal(@"<html><head></head><body><p>No users found!</p></body></html>", output);
}
示例8: Should_not_conflict_when_if_and_ifNot_statements_combined_but_not_nested
public void Should_not_conflict_when_if_and_ifNot_statements_combined_but_not_nested()
{
const string input = @"<html><head></head><body>@IfNot.HasUsers;<p>No users found!</p>@EndIf;@If.HasUsers;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf;</body></html>";
var model = new FakeModel("Nancy", new List<string>());
var output = viewEngine.Render(input, model);
Assert.Equal(@"<html><head></head><body><p>No users found!</p></body></html>", output);
}
示例9: Should_allow_ifnot_and_endif_without_semi_colon
public void Should_allow_ifnot_and_endif_without_semi_colon()
{
// Given
const string input = @"<html><head></head><body>@IfNot.HasUsers<p>No users found!</p>@EndIf<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });
// When
var output = viewEngine.Render(input, model);
// Then
Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
}
示例10: Should_not_render_block_when_ifnot_statements_returns_true
public void Should_not_render_block_when_ifnot_statements_returns_true()
{
// Given
const string input = @"<html><head></head><body>@IfNot.HasUsers;<p>No users found!</p>@EndIf;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });
// When
var output = viewEngine.Render(input, model);
// Then
Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
}
示例11: Should_not_render_block_when_if_statement_returns_false
public void Should_not_render_block_when_if_statement_returns_false()
{
// Given
const string input = @"<html><head></head><body>@If.HasUsers;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf;</body></html>";
var model = new FakeModel("Nancy", new List<string>());
// When
var output = viewEngine.Render(input, model);
// Then
Assert.Equal(@"<html><head></head><body></body></html>", output);
}