public void OpenTextReader_from_embedded_resource_content_with_qualified_name()
        {
            var content = new ContentEmbeddedResource("Gallio.Tests.Common.IO.SampleResource.txt", GetType());

            using (var reader = content.OpenTextReader())
            {
                var actual = reader.ReadToEnd();
                Assert.AreEqual("Hello World!", actual);
            }
        }
        public void OpenTextReader_from_embedded_resource_content_qualified_by_type()
        {
            var content = new ContentEmbeddedResource("SampleResource.txt", GetType());

            using (var reader = content.OpenTextReader())
            {
                var actual = reader.ReadToEnd();
                Assert.AreEqual("Hello World!", actual);
            }
        }
        public void OpenTextReader_from_embedded_resource_content_qualified_by_codeElementInfo()
        {
            var content = new ContentEmbeddedResource("SampleResource.txt", null);
            content.CodeElementInfo = Reflector.Wrap(GetType());

            using (var reader = content.OpenTextReader())
            {
                var actual = reader.ReadToEnd();
                Assert.AreEqual("Hello World!", actual);
            }
        }
        public void OpenStream_from_embedded_resource_content_with_qualified_name()
        {
            var content = new ContentEmbeddedResource("Gallio.Tests.Common.IO.SampleResource.txt", GetType());

            using (var stream = content.OpenStream())
            {
                var actual = new byte[stream.Length];
                stream.Read(actual, 0, (int)stream.Length);
                var byteOrderMarkUtf8 = new byte[] {0xEF, 0xBB, 0xBF};
                Assert.AreElementsEqual(byteOrderMarkUtf8.Concat(Encoding.UTF8.GetBytes("Hello World!")), actual);
            }
        }
 public void OpenTextReader_from_embedded_resource_not_found_should_throw_exception()
 {
     var content = new ContentEmbeddedResource("SomeInvalidResource", null);
     Assert.Throws<PatternUsageErrorException>(() => content.OpenTextReader());
 }