public void insertScreenShotValidInputTest() { ScreenShotActions_Accessor target = new ScreenShotActions_Accessor(true); // TODO: Initialize to an appropriate value ScreenShot screenShot = new ScreenShot(); screenShot.timeStamp = DateTime.Now; screenShot.user = insertedUser; Bitmap bitmap = new Bitmap(800, 600); using (Graphics graphics = Graphics.FromImage(bitmap)) { graphics.CopyFromScreen(0, 0, 0, 0, new Size(800, 600)); } screenShot.image = bitmap; Guid newlyInsertedId = target.insertScreenShot(screenShot); Assert.IsNotNull(newlyInsertedId); ScreenShot returnedScreenShot = target.getScreenShotById(newlyInsertedId); Assert.IsNotNull(returnedScreenShot); Assert.AreEqual(returnedScreenShot.user, insertedUser); Assert.AreEqual(returnedScreenShot.timeStamp.DayOfYear, DateTime.Now.DayOfYear); insertedId = newlyInsertedId; }
public void insertScreenShotNullInputTest() { ScreenShotActions_Accessor target = new ScreenShotActions_Accessor(true); ScreenShot screenShot = null; try { target.insertScreenShot(screenShot); // Exception should be thrown - if it isn't, fail the test Assert.Fail(); } catch (Exception e) { Assert.IsInstanceOfType(e, typeof(System.ArgumentException)); } }