Esempio n. 1
0
 public static void EmbeddedResourcesAreUpToDate()
 {
     // this is meant to catch a case where our embedded test resources are out of date with respect to the current writer.
     // that could be intentional, or accidental.  Regardless we want to know.
     using (Stream resourcesStream = typeof(TestData).Assembly.GetManifestResourceStream("System.Resources.Extensions.Tests.TestData.resources"))
         using (MemoryStream actualData = new MemoryStream(), expectedData = new MemoryStream())
         {
             TestData.WriteResourcesStream(actualData);
             resourcesStream.CopyTo(expectedData);
             Assert.Equal(expectedData.ToArray(), actualData.ToArray());
         }
 }
        public static void EmbeddedResourcesAreUpToDate()
        {
            // this is meant to catch a case where our embedded test resources are out of date with respect to the current writer.
            // that could be intentional, or accidental.  Regardless we want to know.
            using (Stream resourcesStream = typeof(TestData).Assembly.GetManifestResourceStream("System.Resources.Extensions.Tests.TestData.resources"))
                using (MemoryStream actualData = new MemoryStream(), expectedData = new MemoryStream())
                {
                    TestData.WriteResourcesStream(actualData);
                    resourcesStream.CopyTo(expectedData);

                    if (!PlatformDetection.IsNetFramework)
                    {
                        // Some types rely on SerializationInfo.SetType on .NETCore
                        // which result in a different binary format
                        Assert.Equal(expectedData.ToArray(), actualData.ToArray());
                    }
                }
        }