public void CheckCollectionNullOrEmpty_WithEmptyCollection_ThrowsArgumentException() { // Arrange var modelWithEmptyCollection = new GuardTestModel("Test", new object(), new List <object>()); // Act & Assert Assert.Throws <ArgumentException>(() => Guard.CollectionNotNullOrEmpty(() => modelWithEmptyCollection.TestCollection)); }
public void CheckingStringNullOrEmpty_WithNullOrEmptyString_ThrowsArgumentException(string actual) { // Arrange var modelWithNullString = new GuardTestModel(actual, new object(), new List <object>()); // Act & Assert Assert.Throws <ArgumentException>( () => Guard.StringNotNullOrEmpty(() => modelWithNullString.TestString)); }
public void CheckingObjectNull_WithSetObject_DoesNotThrowException() { // Arrange var modelWithSetobject = new GuardTestModel("Test", new object(), new List <object>()); var act = () => Guard.ObjectNotNull(() => modelWithSetobject.TestObject); // Act & Assert act.Should().NotThrow(); }
public void CheckStringNullOrEmpty_WithSetString_DoesNotThrowException() { // Arrange var modelWithSetString = new GuardTestModel("Test", new object(), new List <object>()); var act = () => Guard.StringNotNullOrEmpty(() => modelWithSetString.TestString); // Act & Assert act.Should().NotThrow(); }
public void CheckCollectionNullOrEmpty_WithFilledCollection_DoesNotThrowException() { // Arrange var modelWithFilledCollection = new GuardTestModel( "Test", new object(), new List <object> { new object() }); var act = () => Guard.CollectionNotNullOrEmpty(() => modelWithFilledCollection.TestCollection); // Act & Assert act.Should().NotThrow(); }