Ejemplo n.º 1
0
		public void TestNullableType()
		{
			if( Broker.Provider.GetAnalyzer() != null && GentleSettings.AnalyzerLevel != AnalyzerLevel.None )
			{
				obj1 = new PHNullableType( 0, "Test", null );
				// insert
				obj1.Persist();
				// select raw data to verify that null was written
				SqlResult sr = GetRawTableData();
				Assert.AreEqual( 1, sr.RowsContained );
				Assert.IsNull( sr[ 0, "TDateTime" ], "Expected null to be written, but database contained the value {0}.", sr[ 0, "TDateTime" ] );
				// update
				obj1.NullableDate = null;
				obj1.Persist();
				// select raw data to verify that null was written
				sr = GetRawTableData();
				Assert.AreEqual( 1, sr.RowsContained );
				Assert.IsNull( sr[ 0, "TDateTime" ], "Expected null to be written, but database contained the value {0}.", sr[ 0, "TDateTime" ] );
				// select and verify update
				obj1 = PHNullableType.Retrieve( obj1.Id );
				Assert.IsNull( obj1.NullableDate, "Expected null to be read but actual value read was {0}.", obj1.NullableDate );
				Assert.AreEqual( null, obj1.NullableDate );
				// clean up
				obj1.Remove();
			}
		}
Ejemplo n.º 2
0
 public void TestNullableType()
 {
     if (Broker.Provider.GetAnalyzer() != null && GentleSettings.AnalyzerLevel != AnalyzerLevel.None)
     {
         obj1 = new PHNullableType(0, "Test", null);
         // insert
         obj1.Persist();
         // select raw data to verify that null was written
         SqlResult sr = GetRawTableData();
         Assert.AreEqual(1, sr.RowsContained);
         Assert.IsNull(sr[0, "TDateTime"], "Expected null to be written, but database contained the value {0}.", sr[0, "TDateTime"]);
         // update
         obj1.NullableDate = null;
         obj1.Persist();
         // select raw data to verify that null was written
         sr = GetRawTableData();
         Assert.AreEqual(1, sr.RowsContained);
         Assert.IsNull(sr[0, "TDateTime"], "Expected null to be written, but database contained the value {0}.", sr[0, "TDateTime"]);
         // select and verify update
         obj1 = PHNullableType.Retrieve(obj1.Id);
         Assert.IsNull(obj1.NullableDate, "Expected null to be read but actual value read was {0}.", obj1.NullableDate);
         Assert.AreEqual(null, obj1.NullableDate);
         // clean up
         obj1.Remove();
     }
 }