예제 #1
0
        public async Task Pack_Unpack()
        {
            English.Register();
            ObjectStore.AddOtherAssembly(typeof(Pipeline).Assembly);
            var pipeline1 = await Pipeline.ForAsync(Language.English);

            pipeline1.Version = 123;
            pipeline1.Tag     = "Test";

            using (var ms = new MemoryStream())
            {
                pipeline1.PackTo(ms);
                ms.Seek(0, SeekOrigin.Begin);
                var pipeline2 = await Pipeline.LoadFromPackedAsync(ms);

                Assert.Equal(pipeline1.Version, pipeline2.Version);
                Assert.Equal(pipeline1.Tag, pipeline2.Tag);
                Assert.Equal(string.Join(";", pipeline1.GetModelsDescriptions().Select(md => md.ToString())),
                             string.Join(";", pipeline2.GetModelsDescriptions().Select(md => md.ToString())));
            }
        }