コード例 #1
0
        public void VerifyPropertyWithVerifyGet()
        {
            var mock     = new Mock <IPropertyManager>();
            var nameUser = new PropertyManagerConsumer(mock.Object);

            nameUser.GetName();

            mock.VerifyGet(m => m.FirstName, Times.Once);
        }
コード例 #2
0
        public void StupPropertyWithSetupGet()
        {
            var mock     = new Mock <IPropertyManager>();
            var nameUser = new PropertyManagerConsumer(mock.Object);

            mock.SetupGet(m => m.FirstName).Returns("Shrubbery!");

            var name = nameUser.GetName();

            name.Should().Be("Shrubbery!");
        }