Exemple #1
0
            public void FileDoesNotExist()
            {
                var mockFileSystem = new Mock <IFileSystem>(MockBehavior.Strict);

                mockFileSystem.Setup(fs => fs.FileExists(@"C:\TestRoot\packages\DoesNotExist.1.0\lib\DoesNotExist.dll")).Returns(false);

                NuGetWebProjectSystem projSystem = new NuGetWebProjectSystem(@"C:\TestRoot", mockFileSystem.Object, Dependencies.AssemblyResolver);

                Assert.Throws <FileNotFoundException>(() => projSystem.GetReferenceFilesToAdd(@"TestRoot\packages\DoesNotExist.1.0\lib\DoesNotExist.dll"));
            }
Exemple #2
0
            public void SingleAssembly()
            {
                // arrange
                var    mockFileSystem = new Mock <IFileSystem>(MockBehavior.Strict);
                string mockDirectory  = @"C:\TestRoot\packages\FooPackage.1.0\lib";

                mockFileSystem.Setup(fs => fs.DirectoryGetSubDirs(mockDirectory)).Returns(new string[] { });
                mockFileSystem.Setup(fs => fs.FileExists(Path.Combine(mockDirectory, "FooPackage.dll"))).Returns(true);

                NuGetWebProjectSystem projSystem = new NuGetWebProjectSystem(@"C:\TestRoot", mockFileSystem.Object, Dependencies.AssemblyResolver);

                // act
                var files = projSystem.GetReferenceFilesToAdd(@"TestRoot\packages\FooPackage.1.0\lib\FooPackage.dll");

                // assert
                Dictionary <string, string> expected = new Dictionary <string, string> {
                    { @"C:\TestRoot\packages\FooPackage.1.0\lib\FooPackage.dll", @"C:\TestRoot\bin\FooPackage.dll" }
                };

                Assert.Equal <Dictionary <string, string> >(expected, files);
            }
Exemple #3
0
            public void IncludeSatelliteAssembly()
            {
                string mockDirectory    = @"C:\TestRoot\packages\FooPackage.1.0\lib";
                string mockLocDirectory = Path.Combine(mockDirectory, "ja-JP");
                var    mockFileSystem   = new Mock <IFileSystem>();

                mockFileSystem.Setup(fs => fs.DirectoryGetSubDirs(mockDirectory)).Returns(new string[] { mockLocDirectory });
                mockFileSystem.Setup(fs => fs.DirectoryGetFiles(mockLocDirectory)).Returns(new string[] { Path.Combine(mockLocDirectory, "FooPackage.resources.dll") });
                mockFileSystem.Setup(fs => fs.FileExists(Path.Combine(mockDirectory, "FooPackage.dll"))).Returns(true);

                NuGetWebProjectSystem projSystem = new NuGetWebProjectSystem(@"C:\TestRoot", mockFileSystem.Object, Dependencies.AssemblyResolver);

                // act
                var files = projSystem.GetReferenceFilesToAdd(@"TestRoot\packages\FooPackage.1.0\lib\FooPackage.dll");

                // assert
                Dictionary <string, string> expected = new Dictionary <string, string> {
                    { @"C:\TestRoot\packages\FooPackage.1.0\lib\FooPackage.dll", @"C:\TestRoot\bin\FooPackage.dll" },
                    { @"C:\TestRoot\packages\FooPackage.1.0\lib\ja-JP\FooPackage.resources.dll", @"C:\TestRoot\bin\ja-JP\FooPackage.resources.dll" },
                };

                Assert.Equal <Dictionary <string, string> >(expected, files);
            }