public void CacheProxyReplaysCachedCalls() { var data = new DataStructure { Age = 21, Name = "Jimmy" }; var repo = new ComplexRepository(); var recorder = Mimic.Record <IComplexRepository>(repo); DataStructure firstResult = recorder.GetRelated(data); History history = Mimic.GetHistory(recorder); var replayer = Mimic.Cache <IComplexRepository>( new ComplexRepository2(), history); DataStructure result = replayer.GetRelated(data); Assert.AreEqual(firstResult.Name, result.Name, "otherwise this is because it was not cached"); Assert.AreEqual(firstResult.Age, result.Age, "otherwise this is because it was not cached"); }
public void HistoryMismatchedComplexParameterStillFailsOk() { var tony = new DataStructure() { Name = "tony", Age = 21 }; var repo = new ComplexRepository(); var recorder = Mimic.Record <IComplexRepository>(repo); recorder.GetRelated(tony); History history = Mimic.GetHistory(recorder); var testee = Mimic.GetBehaviourVerifier(history); testee.ConfirmBehaviourHasNotChanged(new ComplexRepository2()); var result = testee.VerificationLog.ToString(); Assert.IsTrue(result.Contains("GetRelated")); Assert.IsTrue(result.Contains("<Name>tony jr.</Name>")); Assert.IsTrue(result.Contains("<Name>tony snr.</Name>")); Assert.IsTrue(result.ToLower().Contains("fail")); }