我正在根據其相關對象中的屬性加載單個業務對象。在這種情況下,有一種擴展材料與材料和工廠具有單一的關係。通過相關業務對象上的屬性加載單個業務對象
此方法位於AppServer類上。 當我運行這段代碼我得到正確的結果和通過的測試,但附加的測試,如果我取消對該行 Broker.GetBusinessObject<ExtendedMaterial>("Plant.PlantCode LIKE " + plantCode);
然後我得到的異常Habanero.Base.Exceptions.InvalidPropertyNameException : The given property name 'PlantCode' does not exist in the collection of properties for the class 'ExtendedMaterial'
我在做什麼錯?
public ExtendedMaterial GetExtendedMaterial(string materialCode, string plantCode)
{
// return Broker.GetBusinessObject<ExtendedMaterial>("Plant.PlantCode LIKE " + plantCode);
return Broker.GetBusinessObjectCollection<ExtendedMaterial>("Plant.PlantCode LIKE " + plantCode).FirstOrDefault();
}
[Test]
public void GetExtendedMaterial_WhenExists_ShouldReturnExtendedMaterial()
{
//---------------Set up test pack-------------------
var material = CreateSavedMaterial();
var plant = GetBOTestFactory<Plant>().CreateSavedBusinessObject();
var extendedMaterial = CreateSavedExtendedMaterial(plant, material);
IAppServer appServer = new AppServer(CreateDeviceManagerWithDevice());
//---------------Assert Precondition----------------
Assert.AreSame(plant, extendedMaterial.Plant);
Assert.AreSame(material, extendedMaterial.Material);
//---------------Execute Test ----------------------
var actualExtendedMaterial = appServer.GetExtendedMaterial(material.Code, plant.PlantCode);
//---------------Test Result -----------------------
Assert.AreSame(extendedMaterial, actualExtendedMaterial);
}
Hi @GloryDev。你使用的是什麼版本的Habanero? – 2011-06-03 08:24:53
來自sourceforge的最新主幹 – GloryDev 2011-06-03 10:15:07