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

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

            subject.Verifiable();

            Assert.IsTrue(subject.Verify);
        }
Beispiel #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);
        }
Beispiel #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);
        }