public void Should_Throw_On_Null_Settings_Parameter() { //Given HttpSettings settings = null; string name = "sessionid"; string value = "1BA9481B-74C1-42B3-A1B9-0B914BAE0F05"; //When var record = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value)); //Then CakeAssert.IsArgumentNullException(record, "settings"); }
public void Should_Throw_On_Null_Or_Empty_Value_Parameter() { //Given HttpSettings settings = new HttpSettings(); string name = "sessionid"; string value = null; //When value = null; var nullRecord = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value)); value = string.Empty; var emptyRecord = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value)); value = " "; var spaceRecord = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value)); //Then CakeAssert.IsArgumentNullException(nullRecord, nameof(value)); CakeAssert.IsArgumentNullException(emptyRecord, nameof(value)); CakeAssert.IsArgumentNullException(spaceRecord, nameof(value)); }
public void Should_Throw_On_Null_Or_Empty_Name_Parameter() { //Given HttpSettings settings = new HttpSettings(); string name = null; string value = "1BA9481B-74C1-42B3-A1B9-0B914BAE0F05"; //When name = null; var nullRecord = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value)); name = string.Empty; var emptyRecord = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value)); name = " "; var spaceRecord = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value)); //Then CakeAssert.IsArgumentNullException(nullRecord, nameof(name)); CakeAssert.IsArgumentNullException(emptyRecord, nameof(name)); CakeAssert.IsArgumentNullException(spaceRecord, nameof(name)); }