public void CheckForNull_DefaultObject_ReturnsProvidedObject() { //Arrange TestObject testObject = null; // Act int?result = testObject.CheckForNull(t => t.NullableInt, 42); // Assert result.Should().Be(42); }
public void CheckForNull_NullObject_ReturnsEmptyString() { //Arrange TestObject testObject = null; // Act // ReSharper disable once ExpressionIsAlwaysNull var result = testObject.CheckForNull(t => t.SomeString); // Assert result.Should().BeEmpty(); }
public void CheckForNull_NullObjectForNullableInt_ReturnsNull() { //Arrange TestObject testObject = null; // Act // ReSharper disable once ExpressionIsAlwaysNull var result = testObject.CheckForNull(t => t.NullableInt); // Assert result.Should().Be(null); }
public void CheckForNull_IntegerForNullableInt_ReturnsNullableInt() { //Arrange var testObject = new TestObject() { NullableInt = 3, }; // Act int?result = testObject.CheckForNull(t => t.NullableInt); // Assert result.Should().Be(3); }
public void CheckForNull_NonNullWithDefaultObject_ReturnsProvidedValue() { //Arrange var testObject = new TestObject() { NullableInt = 3, }; // Act int?result = testObject.CheckForNull(t => t.NullableInt, 42); // Assert result.Should().Be(3); }