예제 #1
0
        public void SaveTest()
        {
            Shape createdObj = null;
            var   c          = new CompositeShape();

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

            c._fileWriter = _mockFileIO.Object;

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

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