Exemplo n.º 1
0
        public void Execute_WithoutSpecialGlobalProperties_ReturnsNull()
        {
            // Arrange
            var buildEngine = new TestBuildEngine();

            var task = new GetGlobalPropertyValueTask()
            {
                BuildEngine  = buildEngine,
                PropertyName = "TargetFramework",
            };

            // Act
            var result = task.Execute();

            // Assert
            result.Should().BeTrue();
            task.GlobalPropertyValue.Should().Be(null);
            task.CheckCompleted.Should().Be(true);
        }
Exemplo n.º 2
0
        public void Execute_WithGlobalProperties_ReturnsValue(string requestedProperty)
        {
            // Arrange
            string expectedValue = "net472";
            Dictionary <string, string> globalProps = new()
            {
                { "TargetFramework", expectedValue }
            };
            var buildEngine = new TestBuildEngine(globalProps);

            var task = new GetGlobalPropertyValueTask()
            {
                BuildEngine  = buildEngine,
                PropertyName = requestedProperty,
            };

            // Act
            var result = task.Execute();

            // Assert
            result.Should().BeTrue();
            task.GlobalPropertyValue.Should().Be(expectedValue);
            task.CheckCompleted.Should().Be(true);
        }