I got the error in unit testing for the method of "AddEffectiveQuarterTest". How to set the property to true that will allow me to insert null values?
AvailabilityBLTest.cs file : "AddEffectiveQuarterTest" method
public void AddEffectiveQuarterTest()
{
AvailabilityBL target = new AvailabilityBL();
AvailabilityDS ds = new AvailabilityDS();
TestBusinessLogic.BusinessLogic_AvailabilityBLAccessor accessor = new TestBusinessLogic.BusinessLogic_AvailabilityBLAccessor(target);
// SETUP STANDARD TEST DATA
this.SetupTestData(ds, null);
int newModelID = -1;
.........
}
AvailabilityDS.Designer.cs file
public string QuarterDisplay {
get {
try {
return ((string)(this[this.tableTime.QuarterDisplayColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'QuarterDisplay\' in table \'Time\' is DBNull.", e);
}
}
set {
this[this.tableTime.QuarterDisplayColumn] = value;
}
}
How do I edit with the following code to set the property to true that will allow me to insert null values?
public bool AllowDBNull { get; set; }
How do I check the dbnull? I got the error with the following code.
public bool IsColumnNameNull() {
return this.IsNull(this.tableColumn.ColumnNameColumn);
}
public string SetColumnKeyNull() {
{
get
{
try
{
return ((string)(this[this.tableColumn.ColumnKeyColumn]));
}
catch (global::System.InvalidCastException e)
{
throw new global::System.Data.StrongTypingException("The value for column \'SetColumnKeyNull\' in table \'Column\' is DBNull.", e);
}
}
set
{
this[this.tableColumn.ColumnKeyColumn] = value;
}
}