示例#1
0
        public void ConstructWithSerializationSuccess(RunnerException rex, IFormatter formatter, MemoryStream stream, Exception e)
        {
            "Given the runner exception"
            .x(() => rex = new RunnerException("an error message"));

            "And a binary formatter for serializing"
            .x(() => formatter = new BinaryFormatter());

            "And a memory stream"
            .x(s => stream = new MemoryStream().Using(s));

            "And a serialized exception"
            .x(s =>
            {
                formatter.Serialize(stream, rex);
                stream.Position = 0;
            });

            "When deserializing the exception"
            .x(() => e = Record.Exception(() => rex = (RunnerException)formatter.Deserialize(stream)));

            "Then the runner exception deserializing constructor should succeed"
            .x(() => e.Should().BeNull());

            "And the exception should have our custom message"
            .x(() => rex.Message.Should().Be("an error message"));
        }
示例#2
0
        public TestMethodInstance GetSkippedInstance(RunnerException runnerException)
        {
            var metadata        = new Dictionary <string, object>();
            var parametersValue = new object[0];
            var classInstance   = GetClassInstance(Method.ReflectedType);

            return(new TestMethodInstance(Attribute, metadata, parametersValue, classInstance, Method, runnerException));
        }
示例#3
0
        public void ConstructWithMessageWithSuccess(RunnerException rex, Exception e)
        {
            "Given the runner exception"
            .x(() => rex.Should().BeNull());

            "When constructing with a message"
            .x(() => e = Record.Exception(() => new RunnerException("an error message")));

            "Then the runner exception constructor should succeed"
            .x(() => e.Should().BeNull());
        }
示例#4
0
        public void ConstructWithNullMessage(RunnerException rex, Exception e)
        {
            "Given the runner exception"
            .x(() => rex.Should().BeNull());

            "When constructing with null message"
            .x(() => e = Record.Exception(() => new RunnerException(null)));

            "Then the runner exception constructor should succeed"
            .x(() => e.Should().BeNull());
        }
示例#5
0
        public void ConstructWithNullInnerException(RunnerException rex, Exception inner, Exception e)
        {
            "Given the runner exception"
            .x(() => rex.Should().BeNull());

            "And a null inner exception"
            .x(() => inner.Should().BeNull());

            "When constructing with null message"
            .x(() => e = Record.Exception(() => new RunnerException("an error message", inner)));

            "Then the runner exception constructor should succeed"
            .x(() => e.Should().BeNull());
        }