Esempio n. 1
0
        public void ctor_ThisAssembly_CanReadTestFile()
        {
            // Arrange

            // ReSharper disable once PossibleNullReferenceException
            var assembly = MethodBase.GetCurrentMethod().DeclaringType.Assembly;

            var resourceSet = new AssemblyResourceSet(assembly);

            // Act

            string result;

            using (var stream = resourceSet.GetFileInfo("fileprovider/test.txt").CreateReadStream())
            {
                using (var reader = new StreamReader(stream))
                {
                    result = reader.ReadToEnd();
                }
            }

            // Assert

            Assert.Equal("test", result);
        }
Esempio n. 2
0
        public void ctor_ThisAssemblyFakeFile_DoesNotExist()
        {
            // Arrange

            // ReSharper disable once PossibleNullReferenceException
            var assembly = MethodBase.GetCurrentMethod().DeclaringType.Assembly;

            var resourceSet = new AssemblyResourceSet(assembly);

            // Act

            var result = resourceSet.GetFileInfo("fileprovider/fake.txt");

            // Assert

            Assert.False(result.Exists);
        }