public void Indexer_Get_ReturnsMatchingParserForType() { var stringParser = new BStringParser(); var list = new BObjectParserList { stringParser }; var parser = list[typeof(BString)]; parser.Should().BeSameAs(stringParser); }
public void Get_Generic_ReturnsMatchingParser() { var stringParser = new BStringParser(); var list = new BObjectParserList { stringParser }; var parser = list.Get <BString>(); parser.Should().BeSameAs(stringParser); }
public void Indexer_Set_AddsParserForType() { var stringParser = new BStringParser(); var list = new BObjectParserList(); list[typeof(BString)] = stringParser; list.Should().HaveCount(1); list[typeof(BString)].Should().BeSameAs(stringParser); }
public void CanParseEncodedAsLatin1() { var encoding = Encoding.GetEncoding("LATIN1"); var expected = new BString("æøå", encoding); var parser = new BStringParser(encoding); // "3:æøå" var bytes = new byte[] { 51, 58, 230, 248, 229 }; var bstring = parser.Parse(bytes); bstring.Should().Be(expected); }
public void Indexer_Set_ReplacesExistingParserForType() { var stringParser1 = new BStringParser(); var stringParser2 = new BStringParser(); var list = new BObjectParserList { stringParser1 }; list[typeof(BString)] = stringParser2; list.Should().HaveCount(1); list[typeof(BString)].Should().BeSameAs(stringParser2); }
public async Task CanParseEncodedAsLatin1Async() { var encoding = Encoding.GetEncoding("LATIN1"); var expected = new BString("æøå", encoding); var parser = new BStringParser(encoding); // "3:æøå" var bytes = new byte[] { 51, 58, 230, 248, 229 }; var(reader, writer) = new Pipe(); await writer.WriteAsync(bytes); var bstring = await parser.ParseAsync(reader); bstring.Should().Be(expected); bstring.GetSizeInBytes().Should().Be(5); }
public BStringParserTests() { Parser = new BStringParser(); }
public void Get_Generic_ReturnsMatchingParser() { var stringParser = new BStringParser(); var list = new BObjectParserList {stringParser}; var parser = list.Get<BString>(); parser.Should().BeSameAs(stringParser); }
public void Indexer_Set_ReplacesExistingParserForType() { var stringParser1 = new BStringParser(); var stringParser2 = new BStringParser(); var list = new BObjectParserList { stringParser1 }; list[typeof (BString)] = stringParser2; list.Should().HaveCount(1); list[typeof (BString)].Should().BeSameAs(stringParser2); }
public void Indexer_Set_AddsParserForType() { var stringParser = new BStringParser(); var list = new BObjectParserList(); list[typeof (BString)] = stringParser; list.Should().HaveCount(1); list[typeof (BString)].Should().BeSameAs(stringParser); }
public void Indexer_Get_ReturnsMatchingParserForType() { var stringParser = new BStringParser(); var list = new BObjectParserList {stringParser}; var parser = list[typeof(BString)]; parser.Should().BeSameAs(stringParser); }