public void ProjectPropertyManager_GetBooleanProperty() { // Arrange var project = new ProjectMock("foo.proj"); ProjectPropertyManager testSubject = this.CreateTestSubject(); // Test case 1: no property -> null // Arrange project.ClearBuildProperty(TestPropertyName); // Act + Assert testSubject.GetBooleanProperty(project, TestPropertyName).Should().BeNull("Expected null for missing property value"); // Test case 2: bad property -> null // Arrange project.SetBuildProperty(TestPropertyName, "NotABool"); // Act + Assert testSubject.GetBooleanProperty(project, TestPropertyName).Should().BeNull("Expected null for bad property value"); // Test case 3: true property -> true // Arrange project.SetBuildProperty(TestPropertyName, true.ToString()); // Act + Assert testSubject.GetBooleanProperty(project, TestPropertyName).Value.Should().BeTrue("Expected true for 'true' property value"); // Test case 4: false property -> false // Arrange project.SetBuildProperty(TestPropertyName, false.ToString()); // Act + Assert testSubject.GetBooleanProperty(project, TestPropertyName).Value.Should().BeFalse("Expected true for 'true' property value"); }
public void ProjectPropertyManager_GetBooleanProperty_NullArgChecks() { // Arrange var project = new ProjectMock("foo.proj"); ProjectPropertyManager testSubject = this.CreateTestSubject(); // Act + Assert Exceptions.Expect <ArgumentNullException>(() => testSubject.GetBooleanProperty(null, "prop")); Exceptions.Expect <ArgumentNullException>(() => testSubject.GetBooleanProperty(project, null)); }