Exemple #1
0
        public void Constructor_SetsMethodCall()
        {
            var methodCall = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine());
            var subject = new Setup(methodCall);

            Assert.AreSame(methodCall, subject.MethodCall);
        }
Exemple #2
0
        public void Verifiable_SetsVerify()
        {
            var methodCall = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine());
            var subject = new Setup(methodCall);

            subject.Verifiable();

            Assert.IsTrue(subject.Verify);
        }
Exemple #3
0
        public void Throws_CreatesException()
        {
            var methodCall = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine());
            var subject = new Setup(methodCall);

            subject.Throws<ArgumentException>();

            Assert.NotNull(subject.Exception);
            Assert.NotNull(subject.Exception.Value);
            Assert.IsInstanceOf<ArgumentException>(subject.Exception.Value);
        }
Exemple #4
0
        public void ThrowsInstance_SetsExceptionToInstance()
        {
            var methodCall = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine());
            var subject = new Setup(methodCall);

            var exception = new ArgumentException();
            subject.Throws(exception);

            Assert.NotNull(subject.Exception);
            Assert.AreSame(exception, subject.Exception.Value);
        }