public void NoCSFile_CreatesNoProjectFile()
            {
                var synchronizer = m_Builder.WithAssemblyData(files: new string[0]).Build();

                synchronizer.Sync();

                Assert.False(
                    m_Builder.FileExists(SynchronizerBuilder.ProjectFilePath(m_Builder.Assembly)),
                    "Should not create csproj file for assembly with no cs file");
            }
            public void WhenSynchronized_WillCreateCSProjectForAssembly()
            {
                var synchronizer = m_Builder.Build();

                Assert.IsFalse(m_Builder.FileExists(SynchronizerBuilder.ProjectFilePath(m_Builder.Assembly)));

                synchronizer.Sync();

                Assert.IsTrue(m_Builder.FileExists(SynchronizerBuilder.ProjectFilePath(m_Builder.Assembly)));
            }
            public void WhenSynchronized_WithTwoAssemblies_TwoProjectFilesAreGenerated()
            {
                var assemblyA    = new Assembly("assemblyA", "path/to/a.dll", new[] { "file.cs" }, new string[0], new Assembly[0], new string[0], AssemblyFlags.None);
                var assemblyB    = new Assembly("assemblyB", "path/to/b.dll", new[] { "file.cs" }, new string[0], new Assembly[0], new string[0], AssemblyFlags.None);
                var synchronizer = m_Builder.WithAssemblies(new[] { assemblyA, assemblyB }).Build();

                synchronizer.Sync();

                Assert.IsTrue(m_Builder.FileExists(SynchronizerBuilder.ProjectFilePath(assemblyA)));
                Assert.IsTrue(m_Builder.FileExists(SynchronizerBuilder.ProjectFilePath(assemblyB)));
            }
            public void ProjectReference_MatchAssemblyGUID()
            {
                string[] files        = { "test.cs" };
                var      assemblyB    = new Assembly("Test", "Temp/Test.dll", files, new string[0], new Assembly[0], new string[0], AssemblyFlags.None);
                var      assemblyA    = new Assembly("Test2", "some/path/file.dll", files, new string[0], new[] { assemblyB }, new[] { "Library.ScriptAssemblies.Test.dll" }, AssemblyFlags.None);
                var      synchronizer = m_Builder.WithAssemblies(new[] { assemblyA, assemblyB }).Build();

                synchronizer.Sync();

                var assemblyACSproject = SynchronizerBuilder.ProjectFilePath(assemblyA);
                var assemblyBCSproject = SynchronizerBuilder.ProjectFilePath(assemblyB);

                Assert.True(m_Builder.FileExists(assemblyACSproject));
                Assert.True(m_Builder.FileExists(assemblyBCSproject));

                XmlDocument scriptProject       = XMLUtilities.FromText(m_Builder.ReadFile(assemblyACSproject));
                XmlDocument scriptPluginProject = XMLUtilities.FromText(m_Builder.ReadFile(assemblyBCSproject));

                var a = XMLUtilities.GetInnerText(scriptPluginProject, "/msb:Project/msb:PropertyGroup/msb:ProjectGuid");
                var b = XMLUtilities.GetInnerText(scriptProject, "/msb:Project/msb:ItemGroup/msb:ProjectReference/msb:Project");

                Assert.AreEqual(a, b);
            }