public void ShouldSaveImageToBmp(string expectedSaveLocationString) { //Given PaintingMediator paint = new PaintingMediator(); CanvasBackService canvasService = new CanvasBackService(); Canvas canvasNode = new Canvas(); canvasService.SetCanvas(canvasNode); paint.SetCanvasService(canvasService); paint.LoadImage("g:\\test.bmp"); //When paint.Save(expectedSaveLocationString); //Then Uri saveLocation = new Uri(expectedSaveLocationString); BitmapImage expectedImage = new BitmapImage(saveLocation); Assert.IsNotNull(expectedImage); }
public void ShouldLoadBmpImage(string path) { //Given PaintingMediator paint = new PaintingMediator(); CanvasBackService canvasService = new CanvasBackService(); Canvas canvasNode = new Canvas(); canvasService.SetCanvas(canvasNode); paint.SetCanvasService(canvasService); //When paint.LoadImage(path); //Then //Loaded image should be in the background of canvas Uri pathUri = new Uri(path); BitmapImage expectedImage = new BitmapImage(pathUri); ImageBrush expectedBrush = new ImageBrush(expectedImage); ImageBrush actualBrush = canvasNode.Background as ImageBrush; Assert.AreEqual(expectedBrush.ImageSource.ToString(), actualBrush.ImageSource.ToString()); }