Пример #1
0
        public void TabDelimitedTextSerializer_Deserialize_FromEmptyStream_Test()
        {
            var serializer = new TabDelimitedTextSerializer();

            using (var stream = new MemoryStream())
            {
                var proteins = serializer.Deserialize(stream);
                Assert.AreEqual(0, proteins.Count);
            }
        }
Пример #2
0
        public void TabDelimitedTextSerializer_Deserialize_Test()
        {
            var serializer = new TabDelimitedTextSerializer();

            using (var stream = File.OpenRead("..\\..\\TestFiles\\ProjectInfo.tab"))
            {
                var collection = serializer.Deserialize(stream);
                Assert.AreEqual(1409, collection.Count);
            }
        }
        public void ProteinCollectionSerializerExtensions_WriteFile_Test()
        {
            var collection = new[] { new Protein() };

            using (var artifacts = new ArtifactFolder())
            {
                var path       = Path.Combine(artifacts.Path, "ProjectInfo.tab");
                var serializer = new TabDelimitedTextSerializer();
                serializer.WriteFile(path, collection);
                Assert.IsTrue(File.Exists(path));
            }
        }
Пример #4
0
        public void TabDelimitedTextSerializer_Serialize_Test()
        {
            var collection = CreateCollectionForSerialize();

            var buffer     = new byte[256];
            var serializer = new TabDelimitedTextSerializer();

            using (var stream = new MemoryStream(buffer))
            {
                serializer.Serialize(stream, collection);
                string text = Encoding.UTF8.GetString(buffer).TrimEnd('\0');
                Debug.WriteLine(text);
                Assert.IsTrue(text.Length > 0 && text.Length < buffer.Length);
            }
        }
 public void BeforeAll()
 {
     _serializer      = new TabDelimitedTextSerializer();
     using var stream = File.OpenRead("TestFiles\\ProjectInfo.tab");
     _expected        = _serializer.DeserializeOld(stream);
 }