コード例 #1
0
        public void ProjectPropertyManager_SetBooleanProperty()
        {
            // Arrange
            var project = new ProjectMock("foo.proj");

            ProjectPropertyManager testSubject = this.CreateTestSubject();

            // Test case 1: true -> property is set true
            // Arrange
            testSubject.SetBooleanProperty(project, TestPropertyName, true);

            // Act + Assert
            project.GetBuildProperty(TestPropertyName).Should().Be(true.ToString(), "Expected property value true for property true");

            // Test case 2: false -> property is set false
            // Arrange
            testSubject.SetBooleanProperty(project, TestPropertyName, false);

            // Act + Assert
            project.GetBuildProperty(TestPropertyName).Should().Be(false.ToString(), "Expected property value true for property true");

            // Test case 3: null -> property is cleared
            // Arrange
            testSubject.SetBooleanProperty(project, TestPropertyName, null);

            // Act + Assert
            project.GetBuildProperty(TestPropertyName).Should().BeNull("Expected property value null for property false");
        }
コード例 #2
0
        public void ProjectPropertyManager_SetBooleanProperty()
        {
            // Setup
            var project = new ProjectMock("foo.proj");

            ProjectPropertyManager testSubject = this.CreateTestSubject();

            // Test case 1: true -> property is set true
            // Setup
            testSubject.SetBooleanProperty(project, TestPropertyName, true);

            // Act + Verify
            Assert.AreEqual(true.ToString(), project.GetBuildProperty(TestPropertyName),
                            ignoreCase: true, message: "Expected property value true for property true");

            // Test case 2: false -> property is set false
            // Setup
            testSubject.SetBooleanProperty(project, TestPropertyName, false);

            // Act + Verify
            Assert.AreEqual(false.ToString(), project.GetBuildProperty(TestPropertyName),
                            ignoreCase: false, message: "Expected property value true for property true");

            // Test case 3: null -> property is cleared
            // Setup
            testSubject.SetBooleanProperty(project, TestPropertyName, null);

            // Act + Verify
            Assert.IsNull(project.GetBuildProperty(TestPropertyName), "Expected property value null for property false");
        }
コード例 #3
0
        public void ProjectPropertyManager_SetBooleanProperty_NullArgChecks()
        {
            // Arrange
            var project = new ProjectMock("foo.proj");
            ProjectPropertyManager testSubject = this.CreateTestSubject();

            // Act + Assert
            Exceptions.Expect <ArgumentNullException>(() => testSubject.SetBooleanProperty(null, "prop", true));
            Exceptions.Expect <ArgumentNullException>(() => testSubject.SetBooleanProperty(project, null, true));
        }