Inheritance: EntityException
コード例 #1
0
        public virtual void ShouldHaveAppropriateInnerException()
        {
            var innerException = new Exception("Test Exception");
            var ex1 = new NotFoundException(100, typeof(InternetOrder), innerException);
            var ex2 = new NotFoundException(100, "Internet Order", innerException);
            var ex3 = new NotFoundException("Gold Orders", typeof(InternetOrder), innerException);
            var ex4 = new NotFoundException("Gold Orders", "Internet Order", innerException);
            var ex5 = new NotFoundException<InternetOrder>(100, innerException);
            var ex6 = new NotFoundException<InternetOrder>("Silver Orders", innerException);

            ex1.InnerException.Should().Be.SameInstanceAs(innerException);
            ex2.InnerException.Should().Be.SameInstanceAs(innerException);
            ex3.InnerException.Should().Be.SameInstanceAs(innerException);
            ex4.InnerException.Should().Be.SameInstanceAs(innerException);
            ex5.InnerException.Should().Be.SameInstanceAs(innerException);
            ex6.InnerException.Should().Be.SameInstanceAs(innerException);
        }
コード例 #2
0
        public virtual void ShouldHaveAppropriateMessage()
        {
            var ex1 = new NotFoundException(100, typeof (InternetOrder));
            var ex2 = new NotFoundException(100, "Internet Order");
            var ex3 = new NotFoundException("Gold Orders", typeof (InternetOrder));
            var ex4 = new NotFoundException("Gold Orders", "Internet Order");
            var ex5 = new NotFoundException<InternetOrder>(100);
            var ex6 = new NotFoundException<InternetOrder>("Silver Orders");

            ex1.Message.Should().Be("Entity with '100' id and 'Taijutsu.Test.Domain.Model.InternetOrder' type has not been found.");

            ex2.Message.Should().Be("Entity with '100' id and 'Internet Order' type has not been found.");

            ex3.Message.Should().Be("Entity of 'Taijutsu.Test.Domain.Model.InternetOrder' type has not been found. Query requires not empty results. Query description: 'Gold Orders'.");

            ex4.Message.Should().Be("Entity of 'Internet Order' type has not been found. Query requires not empty results. Query description: 'Gold Orders'.");

            ex5.Message.Should().Be("Entity with '100' id and 'Taijutsu.Test.Domain.Model.InternetOrder' type has not been found.");

            ex6.Message.Should().Be("Entity of 'Taijutsu.Test.Domain.Model.InternetOrder' type has not been found. Query requires not empty results. Query description: 'Silver Orders'.");
        }
コード例 #3
0
        public virtual void ShouldHaveAppropriateIdAndType()
        {
            var ex1 = new NotFoundException(100, typeof(InternetOrder));
            var ex2 = new NotFoundException(100, "Internet Order");
            var ex3 = new NotFoundException("Gold Orders", typeof(InternetOrder));
            var ex4 = new NotFoundException("Gold Orders", "Internet Order");
            var ex5 = new NotFoundException<InternetOrder>(100);
            var ex6 = new NotFoundException<InternetOrder>("Silver Orders");

            ex1.Id.Should().Be(100);
            ex1.Type.Should().Be(typeof(InternetOrder));
            ex2.Id.Should().Be(100);
            ex2.Type.Should().Be("Internet Order");
            ex3.Id.Should().Be("unknown");
            ex3.Type.Should().Be(typeof(InternetOrder));
            ex4.Id.Should().Be("unknown");
            ex4.Type.Should().Be("Internet Order");
            ex5.Id.Should().Be(100);
            ex5.Type.Should().Be(typeof(InternetOrder));
            ex6.Id.Should().Be("unknown");
            ex6.Type.Should().Be(typeof(InternetOrder));
        }