I am getting the error message saying:
The member specified(SetModelFactory) could not be found. You might need to regenerate your private accessor, or the member may be private and defined on a base class. If the latter is true, you need to pass the type that defines the member into PrivateObject's constructor.
I do try the suggestion at here, but do not work.
public void SetModelFactoryTest()
{
AvailabilityBL target = new AvailabilityBL();
AvailabilityDS ds = new AvailabilityDS();
ds.EnforceConstraints = false;
TestBusinessLogic.BusinessLogic_AvailabilityBLAccessor accessor = new TestBusinessLogic.BusinessLogic_AvailabilityBLAccessor(target);
// SETUP STANDARD TEST DATA
this.SetupTestData(ds, null);
int newModelID = 89;
// ADD A DUMMY MODEL ROW
this.SetupTestModel(newModelID, ds);
accessor.mAvailabilityDS = ds;
int siteID = 22;
int platformID = 33;
string factoryName = "MY COOL FACTORY";
DateTime validUntil = new DateTime(2015, 9, 27);
accessor.SetModelFactory(siteID, platformID, factoryName, validUntil);
Assert.AreEqual(siteID, accessor.mAvailabilityDS.Model[0].SiteID, "SetModelFactory did not set the SiteID.");
Assert.AreEqual(platformID, accessor.mAvailabilityDS.Model[0].PlatformID, "SetModelFactory did not set the PlatformID.");
Assert.AreEqual(factoryName, accessor.mAvailabilityDS.Model[0].FactoryName, "SetModelFactory did not set the FactoryName.");
Assert.AreEqual(validUntil, accessor.mAvailabilityDS.Model[0].ValidUntil, "SetModelFactory did not set the ValidUntil.");
}
VSCodeGenAccessors.cs
internal void SetModelFactory(int siteID, int platformID, string factoryName, global::System.DateTime validUntil) {
object[] args = new object[] {
siteID,
platformID,
factoryName,
validUntil};
m_privateObject.Invoke("SetModelFactory", new System.Type[] {
typeof(int),
typeof(int),
typeof(string),
typeof(global::System.DateTime)}, args);
}
Aucun commentaire:
Enregistrer un commentaire