Esempio n. 1
0
        public void SaveTest()
        {
            Shape createdObj = null;
            var   triangle   = new Triangle(
                new Point(0, 0),
                new Point(3, 0),
                new Point(0, 3));

            _mockFileIO.Setup(x => x.SaveShape(It.IsAny <Stream>(), It.IsAny <Shape>()))
            .Callback <Stream, Shape>((i, x) => { createdObj = x; });

            triangle._fileWriter = _mockFileIO.Object;

            triangle.Save(_mockFileStream.Object);
            Assert.AreEqual(triangle, createdObj);

            _mockFileIO.Verify(x => x.SaveShape(It.IsAny <Stream>(),
                                                It.IsAny <Shape>()), Times.Once);
        }