public void SetUp() { loaderMock = new DynamicMock(typeof(ILoadImageModel)); loaderMock.Strict = true; loader = loaderMock.MockInstance as ILoadImageModel; cutterMock = new DynamicMock(typeof(IImageCutter)); cutterMock.Strict = true; cutter = cutterMock.MockInstance as IImageCutter; model = new PuzzleModel(loader, cutter); updateFred = new Fred(); model.SubscribeUpdateImages(new EventDelegate(updateFred.Update)); AssertFredUpdates(updateFred, 0); piece0 = new Bitmap(1, 1); piece1 = new Bitmap(1, 1); piece2 = new Bitmap(1, 1); piece3 = new Bitmap(1, 1); piece4 = new Bitmap(1, 1); piece5 = new Bitmap(1, 1); piece6 = new Bitmap(1, 1); piece7 = new Bitmap(1, 1); piece8 = new Bitmap(1, 1); pieces = new Image[][] { new Image[] { piece0, piece1, piece2 }, new Image[] { piece3, piece4, piece5 }, new Image[] { piece6, piece7, piece8 } }; }
public void SetUp() { model = new LoadImageModel(); listChangedFred = new Fred(); model.SubscribeImageListChanged(new EventDelegate(listChangedFred.Update)); AssertFredUpdates(listChangedFred, 0); startFred = new Fred(); model.SubscribeStart(new EventDelegate(startFred.Update)); AssertFredUpdates(startFred, 0); finishFred = new Fred(); model.SubscribeFinish(new EventDelegate(finishFred.Update)); AssertFredUpdates(finishFred, 0); }
protected void AssertFredUpdates(Fred fred, int count) { Assert.AreEqual(count, fred.updates); fred.updates = 0; }