public void UnregisterClassMapTest()
        {
            var configuration = new LtsvConfiguration();

            configuration.RegisterClassMap <PlayerMap>();
            configuration.UnregisterClassMap <PlayerMap>();

            var ltsv = "name:kagawa\tNumber:10\tPosition:MF\r\n";

            using (var stringReader = new StringReader(ltsv))
                using (var ltsvReader = new LtsvReader(stringReader, configuration))
                {
                    Assert.True(ltsvReader.Read());

                    var record = ltsvReader.GetRecord <Player>();
                    Assert.Null(record.Name);
                    Assert.Equal(10, record.Number);
                    Assert.Equal("MF", record.Position);
                }
        }
Beispiel #2
0
        public void UnregisterClassMapTest()
        {
            var configuration = new LtsvConfiguration();

            configuration.RegisterClassMap <PlayerMap>();
            configuration.UnregisterClassMap <PlayerMap>();

            var sb = new StringBuilder();

            using (var stringWriter = new StringWriter(sb))
                using (var ltsvWriter = new LtsvWriter(stringWriter, configuration))
                {
                    ltsvWriter.WriteRecord(new Player()
                    {
                        Number   = 10,
                        Name     = "Kagawa",
                        Position = "MF",
                    });
                }

            Assert.Equal("Number:10\tName:Kagawa\tPosition:MF\r\n", sb.ToString());
        }