public void AreEqualPassesWithDirectoryInfos() { var expected = new DirectoryInfo(_goodDir1.ToString()); var actual = new DirectoryInfo(_goodDir1.ToString()); DirectoryAssert.AreEqual(expected, actual); DirectoryAssert.AreEqual(expected, actual); }
public TestContext(TestDirectory testDir) { var fullPath = Path.Combine(testDir, "project.csproj"); var rootDir = Path.GetPathRoot(testDir); var dllDir = Path.Combine(testDir, "bin", "Debug", "net45"); var dllPath = Path.Combine(dllDir, "a.dll"); Directory.CreateDirectory(dllDir); Directory.CreateDirectory(Path.Combine(testDir, "obj")); File.WriteAllBytes(dllPath, new byte[0]); var path = string.Join(".", typeof(PackTaskLogicTests).Namespace, "compiler.resources", "project.assets.json"); using (var reader = new StreamReader(GetType().GetTypeInfo().Assembly.GetManifestResourceStream(path))) { var contents = reader.ReadToEnd(); File.WriteAllText(Path.Combine(testDir, "obj", "project.assets.json"), contents); } TestDir = testDir; Request = new PackTaskRequest { PackageId = "SomePackage", PackageVersion = "3.0.0-beta", Authors = new[] { "NuGet Team", "Unit test" }, AllowedOutputExtensionsInPackageBuildOutputFolder = new[] { ".dll", ".exe", ".winmd", ".json", ".pri", ".xml" }, AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder = new[] { ".dll", ".exe", ".winmd", ".json", ".pri", ".xml", ".pdb", ".mdb" }, Description = "A test package.", PackItem = new MSBuildItem("project.csproj", new Dictionary <string, string> { { "RootDir", rootDir }, { "Directory", testDir.ToString().Substring(rootDir.Length) }, { "FileName", Path.GetFileNameWithoutExtension(fullPath) }, { "Extension", Path.GetExtension(fullPath) }, { "FullPath", fullPath } }), BuildOutputFolders = new string[] { "lib" }, NuspecOutputPath = "obj", IncludeBuildOutput = true, RestoreOutputPath = Path.Combine(testDir, "obj"), ContinuePackingAfterGeneratingNuspec = true, TargetFrameworks = new[] { "net45" }, BuildOutputInPackage = new[] { new MSBuildItem(dllPath, new Dictionary <string, string> { { "FinalOutputPath", dllPath }, { "TargetFramework", "net45" } }) }, Logger = new TestLogger(), SymbolPackageFormat = "symbols.nupkg", FrameworkAssemblyReferences = new MSBuildItem[] { }, FrameworkReferences = new MSBuildItem[] { }, }; }
public void DirectoryInfoNotEqual() { using (var one = new TestDirectory()) using (var two = new TestDirectory()) { #if SILVERLIGHT var expectedMessage = System.String.Format( " Expected: <{0}>{1} But was: <{2}>{1}", one.Directory.Name, Env.NewLine, two.Directory.Name); #else var expectedMessage = System.String.Format( " Expected: <{0}>{1} But was: <{2}>{1}", one.ToString(), Env.NewLine, two.ToString()); #endif var ex = Assert.Throws <AssertionException>(() => Assert.AreEqual(one, two)); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); } }
public void PassesWhenDirectoryStringExists() { Assert.That(_constraint.ApplyTo(_goodDir.ToString()).IsSuccess); Assert.That(_goodDir.ToString(), Does.Exist); }