public async Task ShouldGetListOfReleases()
        {
            Repository.Projects.FindByNames(Arg.Any <IEnumerable <string> >()).Returns(new List <ProjectResource>
            {
                new ProjectResource {
                    Name = "ProjectA", Id = "projectaid"
                },
                new ProjectResource {
                    Name = "ProjectB", Id = "projectbid"
                },
                new ProjectResource {
                    Name = "Version controlled project", Id = VersionControlledProjectId
                }
            });

            Repository.Releases.FindMany(Arg.Any <Func <ReleaseResource, bool> >()).Returns(new List <ReleaseResource>
            {
                new ReleaseResource
                {
                    ProjectId        = "projectaid",
                    Version          = "1.0",
                    Assembled        = DateTimeOffset.MinValue,
                    SelectedPackages = new List <SelectedPackage>
                    {
                        new SelectedPackage("Deploy a package", "1.0")
                    },
                    ReleaseNotes = "Release Notes 1"
                },
                new ReleaseResource
                {
                    ProjectId    = "projectaid",
                    Version      = "2.0",
                    Assembled    = DateTimeOffset.MaxValue,
                    ReleaseNotes = "Release Notes 2"
                },
                new ReleaseResource
                {
                    ProjectId               = VersionControlledProjectId,
                    Version                 = "1.2.3",
                    Assembled               = DateTimeOffset.MaxValue,
                    ReleaseNotes            = "Version controlled release notes",
                    VersionControlReference = new VersionControlReferenceResource
                    {
                        GitCommit = "87a072ad2b4a2e9bf2d7ff84d8636a032786394d",
                        GitRef    = "main"
                    }
                }
            });

            CommandLineArgs.Add("--project=ProjectA");

            await listReleasesCommand.Execute(CommandLineArgs.ToArray()).ConfigureAwait(false);

            this.Assent(LogOutput.ToString().ScrubApprovalString());
        }
Exemplo n.º 2
0
        public async Task ShouldGetListOfReleases()
        {
            Repository.Projects.FindByNames(Arg.Any <IEnumerable <string> >()).Returns(new List <ProjectResource>
            {
                new ProjectResource {
                    Name = "ProjectA", Id = "projectaid"
                },
                new ProjectResource {
                    Name = "ProjectB", Id = "projectbid"
                }
            });

            Repository.Releases.FindMany(Arg.Any <Func <ReleaseResource, bool> >()).Returns(new List <ReleaseResource>
            {
                new ReleaseResource
                {
                    ProjectId    = "projectaid",
                    Version      = "1.0",
                    Assembled    = DateTimeOffset.MinValue,
                    ReleaseNotes = "Release Notes 1"
                },
                new ReleaseResource
                {
                    ProjectId    = "projectaid",
                    Version      = "2.0",
                    Assembled    = DateTimeOffset.MaxValue,
                    ReleaseNotes = "Release Notes 2"
                }
            });

            CommandLineArgs.Add("--project=ProjectA");

            await listReleasesCommand.Execute(CommandLineArgs.ToArray()).ConfigureAwait(false);

            LogLines.Should().Contain(string.Format("Releases: {0}", 2));
            LogLines.Should().Contain(string.Format(" - Project: {0}", "ProjectA"));
            LogLines.Should().Contain(string.Format("    {0}", "Version: 1.0"));
            LogLines.Should().Contain(string.Format("    {0}", "Assembled: " + DateTimeOffset.MinValue));
            LogLines.Should().Contain(string.Format("    {0}", "Package Versions: "));
            LogLines.Should().Contain(string.Format("    {0}", "Release Notes: Release Notes 1"));
            LogLines.Should().Contain(string.Format("    {0}", "Version: 2.0"));
            LogLines.Should().Contain(string.Format("    {0}", "Assembled: " + DateTimeOffset.MaxValue));
            LogLines.Should().Contain(string.Format("    {0}", "Package Versions: "));
            LogLines.Should().Contain(string.Format("    {0}", "Release Notes: Release Notes 2"));
        }