public virtual void ShouldHaveAppropriateInnerException() { var innerException = new Exception("Test Exception"); var ex1 = new NotUniqueException(100, typeof(InternetOrder), innerException); var ex2 = new NotUniqueException(100, "Internet Order", innerException); var ex3 = new NotUniqueException("Gold Orders", typeof(InternetOrder), innerException); var ex4 = new NotUniqueException("Gold Orders", "Internet Order", innerException); var ex5 = new NotUniqueException<InternetOrder>(100, innerException); var ex6 = new NotUniqueException<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); }
public virtual void ShouldHaveAppropriateMessage() { var ex1 = new NotUniqueException(100, typeof(InternetOrder)); var ex2 = new NotUniqueException(100, "Internet Order"); var ex3 = new NotUniqueException("Gold Orders", typeof(InternetOrder)); var ex4 = new NotUniqueException("Gold Orders", "Internet Order"); var ex5 = new NotUniqueException<InternetOrder>(100); var ex6 = new NotUniqueException<InternetOrder>("Silver Orders"); ex1.Message.Should().Be("Entity with '100' id and 'Taijutsu.Test.Domain.Model.InternetOrder' type is not unique."); ex2.Message.Should().Be("Entity with '100' id and 'Internet Order' type is not unique."); ex3.Message.Should().Be("Entity of 'Taijutsu.Test.Domain.Model.InternetOrder' type is not unique. Query requires unique results. Query description: 'Gold Orders'."); ex4.Message.Should().Be("Entity of 'Internet Order' type is not unique. Query requires unique results. Query description: 'Gold Orders'."); ex5.Message.Should().Be("Entity with '100' id and 'Taijutsu.Test.Domain.Model.InternetOrder' type is not unique."); ex6.Message.Should().Be("Entity of 'Taijutsu.Test.Domain.Model.InternetOrder' type is not unique. Query requires unique results. Query description: 'Silver Orders'."); }
public virtual void ShouldHaveAppropriateIdAndType() { var ex1 = new NotUniqueException(100, typeof(InternetOrder)); var ex2 = new NotUniqueException(100, "Internet Order"); var ex3 = new NotUniqueException("Gold Orders", typeof(InternetOrder)); var ex4 = new NotUniqueException("Gold Orders", "Internet Order"); var ex5 = new NotUniqueException<InternetOrder>(100); var ex6 = new NotUniqueException<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)); }