Beispiel #1
0
        public void WhenRefWithCondAlreadyExistsInNonUniformItemGroupItDoesntDuplicate()
        {
            var setup = Setup();
            var proj  = new ProjDir(Path.Combine(setup.TestRoot, "WithRefCondNonUniform"));

            string contentBefore = proj.CsProjContent();
            var    cmd           = new AddP2PCommand()
                                   .WithWorkingDirectory(proj.Path)
                                   .WithProject(proj.CsProjName)
                                   .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");

            cmd.Should().Pass();
            cmd.StdOut.Should().Contain("already has a reference");
            proj.CsProjContent().Should().BeEquivalentTo(contentBefore);
        }
Beispiel #2
0
        public void WhenRefWithCondWithWhitespaceOnItemGroupExistsItDoesntDuplicate()
        {
            var setup = Setup();
            var proj  = new ProjDir(Path.Combine(setup.TestRoot, "WithExistingRefCondWhitespaces"));

            string contentBefore = proj.CsProjContent();
            var    cmd           = new AddP2PCommand()
                                   .WithWorkingDirectory(proj.Path)
                                   .WithProject(proj.CsProjName)
                                   .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");

            cmd.Should().Pass();
            cmd.StdOut.Should().Be("Project already has a reference to `..\\Lib\\Lib.csproj`.");
            proj.CsProjContent().Should().BeEquivalentTo(contentBefore);
        }
Beispiel #3
0
        public void WhenIncompatibleFrameworkDetectedItPrintsError(string frameworkArg)
        {
            var setup    = Setup();
            var lib      = new ProjDir(setup.LibDir);
            var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib"));

            var csProjContent = net45lib.CsProjContent();
            var cmd           = new AddP2PCommand()
                                .WithProject(net45lib.CsProjPath)
                                .Execute($"{frameworkArg} \"{lib.CsProjPath}\"");

            cmd.Should().Fail();
            cmd.StdErr.Should().MatchRegex(ProjectNotCompatibleErrorMessageRegEx);
            cmd.StdErr.Should().MatchRegex(" - net45(\n|\r)");
            net45lib.CsProjContent().Should().BeEquivalentTo(csProjContent);
        }
Beispiel #4
0
        public void WhenFrameworkSwitchIsNotMatchingAnyOfTargetedFrameworksItPrintsError(string framework)
        {
            var setup    = Setup();
            var lib      = new ProjDir(setup.LibDir);
            var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib"));

            var csProjContent = lib.CsProjContent();
            var cmd           = new AddP2PCommand()
                                .WithProject(lib.CsProjPath)
                                .Execute($"-f {framework} \"{net45lib.CsProjPath}\"");

            cmd.Should().Fail();
            cmd.StdErr.Should().MatchRegex(ProjectDoesNotTargetFrameworkErrorMessageRegEx);
            cmd.StdErr.Should().Contain($"`{framework}`");
            lib.CsProjContent().Should().BeEquivalentTo(csProjContent);
        }
Beispiel #5
0
        public void WhenFrameworkSwitchIsNotMatchingAnyOfTargetedFrameworksItPrintsError(string framework)
        {
            var setup    = Setup();
            var lib      = new ProjDir(setup.LibDir);
            var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib"));

            var csProjContent = lib.CsProjContent();
            var cmd           = new AddP2PCommand()
                                .WithProject(lib.CsProjPath)
                                .Execute($"-f {framework} \"{net45lib.CsProjPath}\"");

            cmd.Should().Fail();
            cmd.StdErr.Should().Be($"Project `{setup.LibCsprojPath}` does not target framework `{framework}`.");

            lib.CsProjContent().Should().BeEquivalentTo(csProjContent);
        }