Esempio n. 1
0
        public void Should_Initialize_WithPaths_And_WithRootPath()
        {
            var exception = new ReferenceLoopException(null, "zxc.nested", 123, typeof(DateTimeOffset?));

            exception.Path.Should().BeNull();
            exception.NestedPath.Should().Be("zxc.nested");
            exception.ScopeId.Should().Be(123);
            exception.Type.Should().Be(typeof(DateTimeOffset?));
            exception.Message.Should().Be($"Reference loop detected: object of type Nullable<DateTimeOffset> has been detected twice in the reference graph, effectively creating an infinite references loop (at first under the root path, so the validated object itself, and then under the nested path 'zxc.nested')");
        }
Esempio n. 2
0
        public void Should_Initialize_WithoutPaths()
        {
            var exception = new ReferenceLoopException(123, typeof(DateTimeOffset?));

            exception.Path.Should().BeNull();
            exception.NestedPath.Should().BeNull();
            exception.ScopeId.Should().Be(123);
            exception.Type.Should().Be(typeof(DateTimeOffset?));
            exception.Message.Should().Be($"Reference loop detected: object of type {typeof(DateTimeOffset?).GetFriendlyName()} has been detected twice in the reference graph, effectively creating the infinite references loop (where exactly, that information is not available - is that validation comes from IsValid method, please repeat it using the Validate method and examine the exception thrown)");
        }
Esempio n. 3
0
        public void Should_InitializeMessage()
        {
            var exception = new ReferenceLoopException(null, "zxc.nested", 123, typeof(DateTimeOffset?));

            exception.Path.Should().BeNull();
            exception.NestedPath.Should().Be("zxc.nested");
            exception.ScopeId.Should().Be(123);
            exception.Type.Should().Be(typeof(DateTimeOffset?));
            exception.Message.Should().Be("Reference loop detected: object of type Nullable<DateTimeOffset> is both under the root path and in the nested path zxc.nested");
        }