private static void CanCreateAPartialMultiMockFromClassAndTwoInterfacesCommon(XmlReader reader)
        {
            reader.Expect(x => x.AttributeCount).Return(3);

            ICloneable cloneable = reader as ICloneable;

            Assert.NotNull(cloneable);

            cloneable.Expect(x => x.Clone()).Return(reader);

            IHasXmlNode hasXmlNode = reader as IHasXmlNode;

            Assert.NotNull(hasXmlNode);

            XmlNode node = new XmlDocument();

            hasXmlNode.Expect(x => x.GetNode()).Return(node);

            Assert.Equal(3, reader.AttributeCount);
            Assert.Equal(node, hasXmlNode.GetNode());

            Assert.Same(cloneable, cloneable.Clone());

            reader.VerifyAllExpectations();
        }
Пример #2
0
        private static void CanCreateAStrictMultiMockFromClassAndTwoInterfacesCommon(XmlReader reader)
        {
            reader.Expect(x => x.AttributeCount).Return(3);

              ICloneable cloneable = reader as ICloneable;
              Assert.IsNotNull(cloneable);
              cloneable.Expect(x => x.Clone()).Return(reader);

              IHasXmlNode hasXmlNode = reader as IHasXmlNode;
              Assert.IsNotNull(hasXmlNode);

              XmlNode node = new XmlDocument();
              hasXmlNode.Expect(x => x.GetNode()).Return(node);

              Assert.AreEqual(3, reader.AttributeCount);
              Assert.AreEqual(node, hasXmlNode.GetNode());

              Assert.AreSame(cloneable, cloneable.Clone());

              reader.VerifyAllExpectations();
        }