I'm new to PEX and Moles just wondering how to UnitTest with moles something like below.
I just need a UniDynArray to test. But Creating a UniDynArray depends on the UniSession and UniSession Depends on UniObjects.OpenConnection. When i run this code i get error from ThirdParty dll saying sessions aren't open
Please help
[TestMethod, HostType("Moles")]
public void Constructor2WithMoles()
{
using (MolesContext.Create())
{
//Should I make the Third party session like this ???
MUniSession msession = new MUniSession();
//Here What Actually Happens in the code is uniObject opensession return session
// UniSession session = UniObjects.OpenSession(a,b,c,d); How should i do this
//???? MUniObjects.OpenSessionStringStringStringString = (a, b, c, d) => msession;
MUniDynArray mdata = new MUniDynArray();
mdata.InsertInt32Int32String = (column, index, strValue) =>
{
column = 1;
index = 1;
strValue = "Personal Auto";
};
mdata.InsertInt32Int32String = (column, index, strValue) =>
{
column = 2;
index = 1;
strValue = "1.1";
};
mdata.InsertInt32Int32String = (column, index, strValue) =>
{
column = 3;
index = 1;
strValue = "05/05/2005";
};
mdata.InsertInt32Int32String = (column, index, strValue) =>
{
column = 4;
index = 1;
strValue = "Some Description";
};
mdata.InsertInt32Int32String = (column, index, strValue) =>
{
column = 5;
index = 1;
strValue = "20";
};
mdata.InsertInt32Int32String = (column, index, strValue) =>
{
column = 6;
index = 1;
strValue = "1";
};
History target = new History(mdata, 1);
Assert.AreEqual<string>("Some Description", target.Description);
}
// TODO: CREATE Mole asserts
}