Ejemplo n.º 1
0
        public void Parse_FileStreamIsNull_ThrowsArgumentNullException()
        {
            var    fileName = _fixture.Create <string>();
            Stream stream   = null;
            var    parser   = new FluentTerminalThemeParser();

            Func <Task <TerminalTheme> > parse = () => parser.Parse(fileName, stream);

            parse.Should().Throw <ArgumentNullException>().And.ParamName.Should().Be("fileContent");
        }
Ejemplo n.º 2
0
        public async Task Parse_FileStreamIsNull_ThrowsArgumentNullException()
        {
            var    fileName = _fixture.Create <string>();
            Stream stream   = null;
            var    parser   = new FluentTerminalThemeParser();

            Func <Task <TerminalTheme> > parse = () => parser.Parse(fileName, stream);

            await parse.Should().ThrowAsync <ArgumentNullException>().WithParameterName("fileContent");
        }
Ejemplo n.º 3
0
        public void Parse_InvalidFileName_ThrowsArgumentNullException(string fileName)
        {
            var theme      = _fixture.Create <TerminalTheme>();
            var serialized = JsonConvert.SerializeObject(theme);
            var stream     = new MemoryStream(Encoding.UTF8.GetBytes(serialized));
            var parser     = new FluentTerminalThemeParser();

            Func <Task <TerminalTheme> > parse = () => parser.Parse(fileName, stream);

            parse.Should().Throw <ArgumentNullException>().And.ParamName.Should().Be("fileName");
        }
Ejemplo n.º 4
0
        public void Parse_InvalidFileStream_ThrowsException()
        {
            var fileName   = _fixture.Create <string>();
            var serialized = _fixture.Create <string>();
            var stream     = new MemoryStream(Encoding.UTF8.GetBytes(serialized));
            var parser     = new FluentTerminalThemeParser();

            Func <Task <TerminalTheme> > parse = () => parser.Parse(fileName, stream);

            parse.Should().Throw <Exception>();
        }
Ejemplo n.º 5
0
        public async Task Parse_ValidFileStream_ReturnsTheme()
        {
            var theme      = _fixture.Create <TerminalTheme>();
            var serialized = JsonConvert.SerializeObject(theme);
            var stream     = new MemoryStream(Encoding.UTF8.GetBytes(serialized));
            var parser     = new FluentTerminalThemeParser();

            var parsedTheme = await parser.Parse(theme.Name, stream);

            parsedTheme.Name.Should().Be(theme.Name);
            parsedTheme.Author.Should().Be(theme.Author);
            parsedTheme.PreInstalled.Should().Be(false);
            parsedTheme.Colors.Should().BeEquivalentTo(theme.Colors);
        }