aboutsummaryrefslogblamecommitdiff
path: root/csharp/src/ProtocolBuffers.Test/Compatibility/TestResources.cs
blob: c3ce58834d7d52b9fbfff5395f450457ed747a31 (plain) (tree)
1
2
3
4
5



                                  
                                                    




































                                                                                              
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Google.ProtocolBuffers.Compatibility
{
    static class TestResources
    {
        public static byte[] google_message1
        { 
            get 
            {
                Stream resource = typeof(TestResources).Assembly.GetManifestResourceStream(
                    typeof(TestResources).Namespace + ".google_message1.dat");

                Assert.IsNotNull(resource, "Unable to the locate resource: google_message1");

                byte[] bytes = new byte[resource.Length];
                int amtRead = resource.Read(bytes, 0, bytes.Length);
                Assert.AreEqual(bytes.Length, amtRead);
                return bytes;
            }
        }
        public static byte[] google_message2
        {
            get
            {
                Stream resource = typeof(TestResources).Assembly.GetManifestResourceStream(
                    typeof(TestResources).Namespace + ".google_message2.dat");

                Assert.IsNotNull(resource, "Unable to the locate resource: google_message2");

                byte[] bytes = new byte[resource.Length];
                int amtRead = resource.Read(bytes, 0, bytes.Length);
                Assert.AreEqual(bytes.Length, amtRead);
                return bytes;
            }
        }
    }
}