private static void AssertEqualClpAzlps(List<CoalesceLogPartsBuilder> plclpExpected, AzLogParts azlps, string sTest) { Assert.AreEqual(plclpExpected.Count, azlps.m_plazlp.Values.Count); for (int iclp = 0; iclp < plclpExpected.Count; iclp++) { CoalesceLogPartsBuilder clp = plclpExpected[iclp]; Assert.AreEqual(new DateTime(clp.nYearMin, clp.nMonthMin, clp.nDayMin, clp.nHourMin, 0, 0), azlps.m_plazlp.Values[iclp].DttmMin, "{0}: index {1} match(min) check", sTest, iclp); Assert.AreEqual(new DateTime(clp.nYearMax, clp.nMonthMax, clp.nDayMax, clp.nHourMax, 0 , 0), azlps.m_plazlp.Values[iclp].DttmMac, "{0}: index {1} match(max) check", sTest, iclp); Assert.AreEqual(AzlpsFromNum(clp.nState), azlps.m_plazlp.Values[iclp].State, "{0}: index {1} match check(state)", sTest, iclp); } }
private static AzLogParts AzlpsFromClp(List<CoalesceLogPartsBuilder> plclp) { AzLogParts azlps = new AzLogParts(); foreach (CoalesceLogPartsBuilder clp in plclp) { AzLogPart azlp = AzLogPart.Create(new DateTime(clp.nYearMin, clp.nMonthMin, clp.nDayMin, clp.nHourMin, 0, 0), new DateTime(clp.nYearMax, clp.nMonthMax, clp.nDayMax, clp.nHourMax, 0, 0), AzlpsFromNum(clp.nState)); azlps.m_plazlp.Add(azlp.DttmMin, azlp); } return azlps; }
public static void TestFindPart(int[] rgnKeys, int nFind, int iExpected, bool fMatchExpected) { AzLogParts azlp = new AzLogParts(); foreach (int n in rgnKeys) azlp.m_plazlp.Add(new DateTime(2000 + n, 1, 1), null); bool fMatched; int iResult = azlp.IazlpFindPart(new DateTime(2000 + nFind, 1, 1), out fMatched); Assert.AreEqual(iExpected, iResult); Assert.AreEqual(fMatchExpected, fMatched); }