Esempio n. 1
0
        public void Generate_WhenNullInstance_ThrowsException()
        {
            // Arrange
            var systemUnderTest = new BuildDurationReport();

            // Act
            var actualException = Record.Exception(() => systemUnderTest.Generate(null));

            // Assert
            actualException.Should().NotBeNull();
            actualException.Should().BeOfType <ArgumentNullException>();
        }
Esempio n. 2
0
        public void Generate_WithInstance_GeneratesReport()
        {
            // Arrange
            var expected    = $"SEP=;{Environment.NewLine}Collection;Project;Repistory;Branch;Build nr;Build status;Build result;Build queued;Build start;Build end;{Environment.NewLine}testValue;testValue;testValue;testValue;testValue;testValue;testValue;testValue;testValue;testValue;{Environment.NewLine}";
            var testString  = "testValue";
            var testProject = new AzureDevOpsProject
            {
                Name   = testString,
                Builds = new HashSet <AzureDevOpsBuild>
                {
                    new AzureDevOpsBuild
                    {
                        SourceBranch = testString,
                        BuildNumber  = testString,
                        Status       = testString,
                        Result       = testString,
                        Repository   = new AzureDevOpsSourceRepository
                        {
                            Name = testString,
                        },
                        QueueTime  = testString,
                        StartTime  = testString,
                        FinishTime = testString,
                    },
                },
            };
            var testCollection = new AzureDevOpsCollection {
                Name = testString
            };

            testCollection.Projects.Add(testProject);
            var testAzureDevOpsInstance = new AzureDevOpsInstance();

            testAzureDevOpsInstance.Collections.Add(testCollection);

            var systemUnderTest = new BuildDurationReport();

            // Act
            var actual = systemUnderTest.Generate(testAzureDevOpsInstance);

            // Assert
            actual.Should().NotBeNull();
            actual.Should().Be(expected);
        }