Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- ///A test for button_del_Click
- ///</summary>
- [TestMethod()]
- [DeploymentItem("SDKSample.exe")]
- public void button_del_ClickTest()
- {
- MockRepository mocks = new MockRepository();
- IImageRepository imgRepos = mocks.StrictMock<IImageRepository>();
- using (mocks.Record())
- {
- Expect
- .Call(imgRepos.GetFirstKey())
- .Return(1);
- Expect
- .Call(imgRepos.GetNextKey(1))
- .Return(2);
- Expect
- .Call(imgRepos.GetEntity(1))
- .Return(Image.FromFile("C:\\Users\\abuobe\\Desktop\\Photo_Flipper_Demo_Copy\\TestProject_GraphicalComponents\\images\\pic_011.png"));
- Expect
- .Call(imgRepos.GetEntity(2))
- .Return(Image.FromFile("C:\\Users\\abuobe\\Desktop\\Photo_Flipper_Demo_Copy\\TestProject_GraphicalComponents\\images\\pic_012.png"));
- imgRepos.DelEntity(1);
- LastCall.IgnoreArguments();
- Expect
- .Call(imgRepos.GetNextKey(1))
- .Return(2);
- Expect
- .Call(imgRepos.GetNextKey(2))
- .Return(3);
- Expect
- .Call(imgRepos.GetEntity(2))
- .Return(Image.FromFile("C:\\Users\\abuobe\\Desktop\\Photo_Flipper_Demo_Copy\\TestProject_GraphicalComponents\\images\\pic_014.png"));
- Expect
- .Call(imgRepos.GetEntity(3))
- .Return(Image.FromFile("C:\\Users\\abuobe\\Desktop\\Photo_Flipper_Demo_Copy\\TestProject_GraphicalComponents\\images\\pic_015.png"));
- }
- IDisplayParametersRepository dispParamRepos = mocks.StrictMock<IDisplayParametersRepository>();
- using (mocks.Record())
- {
- Expect
- .Call(dispParamRepos.GetUserKey())
- .Return(2);
- Expect
- .Call(dispParamRepos.GetEntity(2))
- .Return(new DisplayParameters(new System.Windows.Media.Media3D.Point3D(0.05, 0.05, 0.05), TimeSpan.FromMilliseconds(1000)));
- }
- Window1_Accessor target = new Window1_Accessor(); // TODO: Initialize to an appropriate value
- target._imgRepository = imgRepos;
- target._dispParamRepository = dispParamRepos;
- object sender = this; // TODO: Initialize to an appropriate value
- EventArgs e = EventArgs.Empty; // TODO: Initialize to an appropriate value
- target.OnLoaded(sender, e);
- target.button_del_Click(null, null);
- Assert.AreEqual(target._currentPic, 2);
- }
Add Comment
Please, Sign In to add comment