示例#1
0
        public void TestMethod2()
        {
            var encryption = new Mock <IFakeSingnal>();

            encryption.Setup(_ => _.FakeSignalCall());



            EncryptionMediator mediator = new EncryptionMediator(encryption.Object);

            //mediator.DecryptFile("", "");
            mediator.ReadBson("", "", "");

            encryption.Verify(_ => _.FakeSignalCall(), Times.Exactly(2));
        }
示例#2
0
        public void TestMethod2()
        {
            bool flag            = true;
            var  fakeSingnalMock = new Mock <FakeSingalFactory>();

            fakeSingnalMock.SetupAllProperties();
            //fakeSingnalMock.Setup(_ => _.EncryptionMethod.IsFakeSingnal).Callback<bool>(value => flag = value).Returns(flag);
            fakeSingnalMock.Setup(_ => _.EncryptionMethod.FakeSignal(It.IsAny <Exception>()));
            fakeSingnalMock.Setup(_ => _.BsonMethod.FakeSignal(It.IsAny <Exception>()));



            EncryptionMediator mediator = new EncryptionMediator(fakeSingnalMock.Object);

            Action empty = () => { mediator.ReadBson("", "", ""); };

            empty.Invoke();

            //fakeSingnalMock.Verify(_ => _.EncryptionMethod.FakeSignal(It.IsAny<Exception>()), Times.AtLeastOnce);
            //fakeSingnalMock.Verify(_ => _.BsonMethod.FakeSignal(It.IsAny<Exception>()), Times.AtLeastOnce);


            Xunit.Assert.ThrowsAny <Exception>(empty);
        }