public void NullArguments() { var type = GetType(); var assembly = type.GetAssembly(); var stream = Stream.Null; var dataContext = new object(); var document = new Document(); var target = new TextRenderTarget(); var buffer = new ConsoleBuffer(80); var renderRect = Rect.Empty; #if XAML var resourceName = ""; new Action(() => ConsoleRenderer.ReadElementFromStream <Br>(null, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(stream)); new Action(() => ConsoleRenderer.ReadElementFromResource <Br>((Assembly)null, resourceName, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(assembly)); new Action(() => ConsoleRenderer.ReadElementFromResource <Br>(assembly, null, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(resourceName)); new Action(() => ConsoleRenderer.ReadElementFromResource <Br>((Type)null, resourceName, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(type)); new Action(() => ConsoleRenderer.ReadElementFromResource <Br>(type, null, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(resourceName)); new Action(() => ConsoleRenderer.ReadDocumentFromStream(null, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(stream)); new Action(() => ConsoleRenderer.ReadDocumentFromResource((Assembly)null, resourceName, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(assembly)); new Action(() => ConsoleRenderer.ReadDocumentFromResource(assembly, null, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(resourceName)); new Action(() => ConsoleRenderer.ReadDocumentFromResource((Type)null, resourceName, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(type)); new Action(() => ConsoleRenderer.ReadDocumentFromResource(type, null, dataContext)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(resourceName)); #endif new Action(() => ConsoleRenderer.RenderDocument(null)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(document)); new Action(() => ConsoleRenderer.RenderDocumentToBuffer(null, buffer, renderRect)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(document)); new Action(() => ConsoleRenderer.RenderDocumentToBuffer(document, null, renderRect)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(buffer)); new Action(() => ConsoleRenderer.RenderDocumentToText(null, target)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(document)); new Action(() => ConsoleRenderer.RenderDocumentToText(document, null)) .Should().Throw <ArgumentNullException>().Which.ParamName.Should().Be(nameof(target)); }
public void ReadElementFromResourceWithContext() { Span span = ConsoleRenderer.ReadElementFromResource <Span>(typeof(Res).Assembly, $"{typeof(Res).Namespace}.{Res.SpanWithContext}", "abc"); span.Text.Should().Be("3"); }
public void ReadElementFromResourceError() { new Action(() => ConsoleRenderer.ReadElementFromResource <Span>(typeof(Res).Assembly, "Oops", null)) .ShouldThrow <FileNotFoundException>().WithMessage("*Oops*not found*"); }
public void ReadElementFromResource() { Span span = ConsoleRenderer.ReadElementFromResource <Span>(typeof(Res).Assembly, $"{typeof(Res).Namespace}.{Res.Span}", null); span.Text.Should().Be("Foo"); }
public void ReadElementFromResourceByTypeWithContext() { Span span = ConsoleRenderer.ReadElementFromResource <Span>(typeof(Res), Res.SpanWithContext, "abc"); span.Text.Should().Be("3"); }
public void ReadElementFromResourceByType() { Span span = ConsoleRenderer.ReadElementFromResource <Span>(typeof(Res), Res.Span, null); span.Text.Should().Be("Foo"); }