Exemple #1
0
            public void WhenNoFileExistsOnDisk_ThenSaveToDisk()
            {
                var sut = AssemblyEmbeddedResource.CreateFromAssemblyContaining <AssemblyEmbeddedResourceTests>(TestFileNames.ExistingEmbeddedFile);

                var fileInfo = sut.Save(GetWorkingPath(sut.FileName));

                AssertFile.ContentEquals(fileInfo, "Embedded Resource 1");
            }
Exemple #2
0
            public void WhenEmbeddedFileExists_ThenSetProperties()
            {
                AssemblyEmbeddedResource sut = AssemblyEmbeddedResource.CreateFromAssemblyContaining <AssemblyEmbeddedResourceTests>(TestFileNames.ExistingEmbeddedFile);

                Assert.That(sut.Assembly, Is.EqualTo(typeof(AssemblyEmbeddedResourceTests).Assembly));
                Assert.That(sut.FileName, Is.EqualTo(TestFileNames.ExistingEmbeddedFile));
                Assert.That(sut.ResourceName, Is.EqualTo($"ByteDev.Reflection.IntTests.TestFiles.{TestFileNames.ExistingEmbeddedFile}"));
            }
Exemple #3
0
            public void WhenFileAlreadyExists_ThenThrowException()
            {
                var saveFilePath = GetWorkingPath(TestFileNames.ExistingEmbeddedFile);

                FileBuilder.InFileSystem.WithPath(saveFilePath).Build();

                var sut = AssemblyEmbeddedResource.CreateFromAssemblyContaining <AssemblyEmbeddedResourceTests>(TestFileNames.ExistingEmbeddedFile);

                Assert.Throws <IOException>(() => sut.Save(saveFilePath));
            }
Exemple #4
0
 public void WhenFileIsContentFile_ThenThrowException()
 {
     Assert.Throws <FileNotFoundException>(() => AssemblyEmbeddedResource.CreateFromAssemblyContaining <AssemblyEmbeddedResource>(TestFileNames.ExistingContentFile));
 }
Exemple #5
0
 public void WhenEmbeddedFileDoesNotExist_ThenThrowException()
 {
     Assert.Throws <FileNotFoundException>(() => AssemblyEmbeddedResource.CreateFromAssemblyContaining <AssemblyEmbeddedResourceTests>(TestFileNames.NotExistingEmbeddedFile));
 }