From f293ca3d71877c1953f11bae1124e4310f9246f1 Mon Sep 17 00:00:00 2001 From: Khanbala Rashidov <50279392+KhanbalaRashidov@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:23:29 +0400 Subject: [PATCH] CODE RUB: Refactor Foundations Test Methods --- .../CommentServiceTests.Exceptions.Add.cs | 50 ++++-------- .../CommentServiceTests.Exceptions.Modify.cs | 80 +++++-------------- ...mmentServiceTests.Exceptions.RemoveById.cs | 4 - .../CommentServiceTests.Validation.Modify.cs | 4 - .../CommentServiceTests.Validations.Add.cs | 12 --- ...mentServiceTests.Validations.RemoveById.cs | 8 -- ...ntServiceTests.Validations.RetrieveById.cs | 4 - .../EventServiceTests.Exceptions.Add.cs | 26 +----- ...ventServiceTests.Exceptions.RetrieveAll.cs | 3 +- .../EventServiceTests.Validations.Add.cs | 8 -- ...upMembershipServiceTests.Exceptions.Add.cs | 20 +---- ...pMembershipServiceTests.Validations.Add.cs | 10 +-- ...ipServiceTests.Validations.RetrieveById.cs | 4 - ...upPostServiceTests.Exception.RemoveById.cs | 4 - ...GroupPostServiceTests.Exceptions.Modify.cs | 27 ++++--- ...PostServiceTests.Exceptions.RetrieveAll.cs | 6 +- .../GroupPostServiceTests.Logic.Modify.cs | 7 +- .../GroupPostServiceTests.Logic.RemoveById.cs | 6 +- ...roupPostServiceTests.Logic.RetrieveById.cs | 2 +- .../GroupPostServiceTests.Validations.Add.cs | 10 +-- ...roupPostServiceTests.Validations.Modify.cs | 18 ++--- ...PostServiceTests.Validations.RemoveById.cs | 10 +-- ...stServiceTests.Validations.RetrieveById.cs | 4 - .../GroupServiceTests.Exceptions.Add.cs | 26 +----- .../GroupServiceTests.Exceptions.Modify.cs | 46 +---------- .../GroupServiceTests.Validations.Add.cs | 18 +---- .../GroupServiceTests.Validations.Modify.cs | 26 +----- ...roupServiceTests.Validations.RemoveById.cs | 14 +--- ...upServiceTests.Validations.RetrieveById.cs | 4 - .../GroupServiceTestsExceptions.RemovebyId.cs | 12 --- ...ImpressionServiceTests.Exception.Modify.cs | 8 +- ...stImpressionServiceTests.Exceptions.Add.cs | 40 +++------- ...ssionServiceTests.Exceptions.RemoveById.cs | 12 +-- ...sionServiceTests.Exceptions.RetrieveAll.cs | 6 +- ...PostImpressionServiceTests.Logic.Modify.cs | 6 +- ...ImpressionServiceTests.Logic.RemoveById.cs | 6 +- ...mpressionServiceTests.Logic.RetrieveAll.cs | 3 +- ...mpressionServiceTests.Validation.Modify.cs | 61 +++++++------- ...tImpressionServiceTests.Validations.Add.cs | 21 +---- ...sionServiceTests.Validations.RemoveById.cs | 17 +--- ...onServiceTests.Validations.RetrieveById.cs | 4 - ...eportServiceTests.Exception.RetrieveAll.cs | 12 ++- .../PostReportServiceTests.Exceptions.Add.cs | 24 ++++-- ...ortServiceTests.Exceptions.RetrieveById.cs | 12 ++- .../PostReportServiceTests.Logic.Add.cs | 6 +- ...stReportServiceTests.Logic.RetrieveById.cs | 3 +- .../PostReportServiceTests.Logic.cs | 3 +- .../PostReportServiceTests.Validation.Add.cs | 27 +++---- ...rtServiceTests.Validations.RetrieveById.cs | 12 +-- .../Posts/PostServiceTests.Exceptions.Add.cs | 36 +++------ .../PostServiceTests.Exceptions.Modify.cs | 16 +--- .../PostServiceTests.Exceptions.RemoveById.cs | 4 - .../PostServiceTests.Validation.Modify.cs | 16 ---- .../Posts/PostServiceTests.Validations.Add.cs | 12 --- ...PostServiceTests.Validations.RemoveById.cs | 8 -- ...stServiceTests.Validations.RetrieveById.cs | 4 - .../ProfileServiceTests.Exceptions.Add.cs | 20 ----- .../ProfileServiceTests.Exceptions.Modify.cs | 80 +++++-------------- ...ofileServiceTests.Exceptions.RemoveById.cs | 20 +---- ...fileServiceTests.Exceptions.RetrieveAll.cs | 3 +- .../ProfileServiceTests.Validations.Add.cs | 28 ++----- .../ProfileServiceTests.Validations.Modify.cs | 24 ------ ...fileServiceTests.Validations.RemoveById.cs | 16 +--- ...leServiceTests.Validations.RetrieveById.cs | 4 - 64 files changed, 279 insertions(+), 768 deletions(-) diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Add.cs index 7fe966c7..f0dd546c 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Add.cs @@ -51,19 +51,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertCommentAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( expectedCommentDependencyException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyValidationExceptionOnAddIfCommentAlreadyExsitsAndLogItAsync() @@ -101,20 +97,16 @@ await Assert.ThrowsAsync( this.dateTimeBrokerMock.Verify(broker => broker.GetCurrentDateTimeOffset(), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.InsertCommentAsync(It.IsAny()), - Times.Never); - + this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedCommentDependencyValidationException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyExceptionOnAddIfDatabaseUpdateErrorOccursAndLogItAsync() @@ -151,19 +143,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertCommentAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedCommentDependencyException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowServiceExceptionOnAddIfDatabaseUpdateErrorOccursAndLogItAsync() @@ -198,19 +186,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertCommentAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedCommentServiceException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async void ShouldThrowValidationExceptionOnAddIfReferenceErrorOccursAndLogItAsync() diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Modify.cs index 455938b4..a6f726e0 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.Modify.cs @@ -51,23 +51,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectCommentByIdAsync(randomComment.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( expectedCommentDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateCommentAsync(randomComment), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async void ShouldThrowValidationExceptionOnModifyIfReferenceErrorOccursAndLogItAsync() @@ -106,23 +98,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectCommentByIdAsync(foreignKeyConflictedComment.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedCommentDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateCommentAsync(foreignKeyConflictedComment), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyExceptionOnModifyIfDatabaseUpdateExceptionOccursAndLogItAsync() @@ -157,23 +141,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectCommentByIdAsync(randomComment.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedCommentDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateCommentAsync(randomComment), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyValidationExceptionOnModifyIfDatabaseUpdateConcurrencyErrorOccursAndLogItAsync() @@ -208,23 +184,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectCommentByIdAsync(randomComment.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedCommentDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateCommentAsync(randomComment), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowServiceExceptionOnModifyIfServiceErrorOccursAndLogItAsync() @@ -259,22 +227,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectCommentByIdAsync(randomComment.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedCommentServiceException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateCommentAsync(randomComment), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } } } \ No newline at end of file diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.RemoveById.cs index 9c8fc811..8d76acca 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Exceptions.RemoveById.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedCommentDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteCommentAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validation.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validation.Modify.cs index 7831520e..391ac413 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validation.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validation.Modify.cs @@ -43,10 +43,6 @@ await Assert.ThrowsAsync( expectedCommentValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateCommentAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.Add.cs index 3402329e..c024f32e 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.Add.cs @@ -109,10 +109,6 @@ await Assert.ThrowsAsync( expectedCommentValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertCommentAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -164,10 +160,6 @@ await Assert.ThrowsAsync( expectedCommentValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertCommentAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -223,10 +215,6 @@ await Assert.ThrowsAsync( expectedCommentValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertCommentAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RemoveById.cs index 0d728ffe..aa894573 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RemoveById.cs @@ -48,10 +48,6 @@ await Assert.ThrowsAsync( expectedCommentValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteCommentAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -95,10 +91,6 @@ await Assert.ThrowsAsync( expectedCommentValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteCommentAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RetrieveById.cs index 27a266be..de7e5494 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Comments/CommentServiceTests.Validations.RetrieveById.cs @@ -48,10 +48,6 @@ await Assert.ThrowsAsync( expectedCommentValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectCommentByIdAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.Add.cs index 8c781613..5977ecec 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.Add.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedEventDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertEventAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -104,18 +100,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertEventAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedEventDependencyValidationException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -160,10 +152,6 @@ await Assert.ThrowsAsync( expectedEventDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertEventAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -204,18 +192,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertEventAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedEventDependencyException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -251,18 +235,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertEventAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedEventServiceException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } } } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.RetrieveAll.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.RetrieveAll.cs index 58a7843d..9bbe3572 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.RetrieveAll.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Exceptions.RetrieveAll.cs @@ -75,7 +75,8 @@ public void ShouldThrowServiceExceptionOnRetrieveAllIfServiceErrorOccursAndLogIt // then actualEventServiceException.Should().BeEquivalentTo(expectedEventServiceException); - this.storageBrokerMock.Verify(broker => broker.SelectAllEvents(), Times.Once); + this.storageBrokerMock.Verify(broker => + broker.SelectAllEvents(), Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs(expectedEventServiceException))), diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Validations.Add.cs index fdbc0f2e..f3b3b910 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Events/EventServiceTests.Validations.Add.cs @@ -108,10 +108,6 @@ await Assert.ThrowsAsync( expectedEventValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertEventAsync(invalidEvent), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -170,10 +166,6 @@ await Assert.ThrowsAsync( expectedEventValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertEventAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Exceptions.Add.cs index d7958b9a..1288407c 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Exceptions.Add.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedGroupMembershipDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupMembershipAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -108,10 +104,6 @@ await Assert.ThrowsAsync( expectedGroupMembershipDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupMembershipAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -156,13 +148,9 @@ await Assert.ThrowsAsync( expectedGroupMembershipDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupMembershipAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -203,13 +191,9 @@ await Assert.ThrowsAsync( expectedGroupMembershipServiceException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupMembershipAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } } } \ No newline at end of file diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.Add.cs index 24bf22b2..513a2506 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.Add.cs @@ -104,13 +104,9 @@ await Assert.ThrowsAsync( expectedGroupMembershipValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupMembershipAsync(invalidGroupMembership), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Theory] @@ -162,10 +158,6 @@ await Assert.ThrowsAsync( expectedGroupMembershipValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupMembershipAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.RetrieveById.cs index 990c64b2..a338213c 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupMemberships/GroupMembershipServiceTests.Validations.RetrieveById.cs @@ -47,10 +47,6 @@ await Assert.ThrowsAsync( expectedGroupMembershipValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupMembershipByIdAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exception.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exception.RemoveById.cs index 7d067837..dd3bf5b4 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exception.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exception.RemoveById.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedGroupPostDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupPostAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.Modify.cs index c9220927..06fb9a73 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.Modify.cs @@ -52,13 +52,12 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( - expectedGroupPostDependencyException))), Times.Once); + expectedGroupPostDependencyException))), + Times.Once); this.storageBrokerMock.Verify(broker => - broker.SelectGroupPostByIdAsync(groupId, postId), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupPostAsync(someGroupPost), Times.Never); + broker.SelectGroupPostByIdAsync(groupId, postId), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -99,11 +98,13 @@ await Assert.ThrowsAsync( expectedGroupPostDependencyException); this.storageBrokerMock.Verify(broker => - broker.SelectGroupPostByIdAsync(groupId, postId), Times.Once); + broker.SelectGroupPostByIdAsync(groupId, postId), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostDependencyException))), Times.Once); + expectedGroupPostDependencyException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -143,11 +144,13 @@ await Assert.ThrowsAsync( expectedGroupPostDependencyValidationException); this.storageBrokerMock.Verify(broker => - broker.SelectGroupPostByIdAsync(groupId, postId), Times.Once); + broker.SelectGroupPostByIdAsync(groupId, postId), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostDependencyValidationException))), Times.Once); + expectedGroupPostDependencyValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -186,11 +189,13 @@ await Assert.ThrowsAsync( expectedGroupPostServiceException); this.storageBrokerMock.Verify(broker => - broker.SelectGroupPostByIdAsync(someGroupPost.GroupId, someGroupPost.PostId), Times.Once); + broker.SelectGroupPostByIdAsync(someGroupPost.GroupId, someGroupPost.PostId), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostServiceException))), Times.Once); + expectedGroupPostServiceException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.RetrieveAll.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.RetrieveAll.cs index 49cda81e..1d4ac714 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.RetrieveAll.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Exceptions.RetrieveAll.cs @@ -45,7 +45,8 @@ public void ShouldThrowCriticalDependencyExceptionOnRetrieveAllIfSqlErrorOccursA this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( - expectedGroupPostDependencyException))), Times.Once); + expectedGroupPostDependencyException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -82,7 +83,8 @@ public void ShouldThrowServiceExceptionOnRetrieveAllWhenAllServiceErrorOccursAnd this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostServiceException))), Times.Once); + expectedGroupPostServiceException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.Modify.cs index eb0cf235..8c7160c3 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.Modify.cs @@ -47,12 +47,15 @@ public async Task ShouldModifyGroupPostAsync() actualGroupPost.Should().BeEquivalentTo(exceptedGroupPost); this.storageBrokerMock.Verify(broker => - broker.UpdateGroupPostAsync(inputGroupPost), Times.Once); + broker.UpdateGroupPostAsync(inputGroupPost), + Times.Once); this.storageBrokerMock.Verify(broker => - broker.SelectGroupPostByIdAsync(groupId, postId), Times.Once); + broker.SelectGroupPostByIdAsync(groupId, postId), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); } } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RemoveById.cs index d95720b8..1ec7084d 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RemoveById.cs @@ -45,10 +45,12 @@ public async Task ShouldRemoveGroupPostByIdAsync() actualGroupPost.Should().BeEquivalentTo(expectedGroupPost); this.storageBrokerMock.Verify(broker => - broker.SelectGroupPostByIdAsync(inputGroupId, inputPostId), Times.Once); + broker.SelectGroupPostByIdAsync(inputGroupId, inputPostId), + Times.Once); this.storageBrokerMock.Verify(broker => - broker.DeleteGroupPostAsync(expectedInputGroupPost), Times.Once); + broker.DeleteGroupPostAsync(expectedInputGroupPost), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RetrieveById.cs index 21cbc273..a843e59d 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Logic.RetrieveById.cs @@ -44,8 +44,8 @@ await this.groupPostService.RetrieveGroupPostByIdAsync( Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); } } } \ No newline at end of file diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Add.cs index 717f6e45..9adba056 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Add.cs @@ -42,10 +42,10 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupPostValidationException))), - Times.Once); + Times.Once); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -86,17 +86,13 @@ await Assert.ThrowsAsync( actualGroupPostValidationException.Should().BeEquivalentTo( expectedGroupPostValidationException); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupPostAsync(invalidGroupPost), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupPostValidationException))), Times.Once); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } } } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Modify.cs index 5c4af410..8b89ba9b 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.Modify.cs @@ -39,10 +39,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupPostAsync(It.IsAny()), Times.Never); + expectedGroupPostValidationException))), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -90,10 +88,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupPostAsync(It.IsAny()), Times.Never); + expectedGroupPostValidationException))), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -131,11 +127,13 @@ public async Task ShouldThrowValidationExceptionOnModifyIfGroupPostDoesNotExistA this.storageBrokerMock.Verify(broker => broker.SelectGroupPostByIdAsync(nonExistGroupPost.GroupId, - nonExistGroupPost.PostId), Times.Once); + nonExistGroupPost.PostId), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostValidationException))), Times.Once); + expectedGroupPostValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RemoveById.cs index edc52eeb..cd59c0ca 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RemoveById.cs @@ -52,10 +52,6 @@ await Assert.ThrowsAsync( expectedGroupPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupPostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); } @@ -98,10 +94,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedGroupPostValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupPostAsync(It.IsAny()), Times.Never); + expectedGroupPostValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RetrieveById.cs index cf4c622a..49f7a179 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/GroupPosts/GroupPostServiceTests.Validations.RetrieveById.cs @@ -51,10 +51,6 @@ await Assert.ThrowsAsync( expectedGroupPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupPostByIdAsync(invalidGroupId, invalidPostId), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Add.cs index 051c01fd..bc8d177f 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Add.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedGroupDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -103,18 +99,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupDependencyValidationException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -159,10 +151,6 @@ await Assert.ThrowsAsync( expectedGroupDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -203,18 +191,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupDependencyException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -250,18 +234,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupServiceException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } } } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Modify.cs index 8cb628bf..c6468dbf 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Exceptions.Modify.cs @@ -51,22 +51,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(randomGroup.Id), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(randomGroup), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( expectedGroupDependencyException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -114,21 +106,13 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(foreignKeyConflictedGroup.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs(expectedGroupDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(foreignKeyConflictedGroup), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -164,19 +148,11 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(randomGroup.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(randomGroup), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -215,22 +191,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(randomGroup.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(randomGroup), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -266,19 +234,11 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(randomGroup.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedGroupServiceException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(randomGroup), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Add.cs index 1ad3f4c3..b1f49ae4 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Add.cs @@ -45,9 +45,9 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); } [Theory] @@ -107,10 +107,6 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(invalidGroup), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); } @@ -161,10 +157,6 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -220,10 +212,6 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Modify.cs index f92bc039..233b3963 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.Modify.cs @@ -42,17 +42,9 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(It.IsAny()), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); } [Theory] @@ -124,10 +116,6 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(invalidGroup), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -174,10 +162,6 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertGroupAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -228,14 +212,6 @@ await Assert.ThrowsAsync( expectedGroupValidatonException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(It.IsAny()), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.UpdateGroupAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RemoveById.cs index 77a4b806..91d1f1f2 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RemoveById.cs @@ -48,16 +48,8 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(It.IsAny()), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupAsync(It.IsAny()), - Times.Never); - - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); } @@ -99,10 +91,6 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RetrieveById.cs index a046a1da..f239a3c4 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTests.Validations.RetrieveById.cs @@ -48,10 +48,6 @@ await Assert.ThrowsAsync( expectedGroupValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectGroupByIdAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTestsExceptions.RemovebyId.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTestsExceptions.RemovebyId.cs index 91d9d0fc..9c034f05 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTestsExceptions.RemovebyId.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Groups/GroupServiceTestsExceptions.RemovebyId.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedGroupDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -106,10 +102,6 @@ await Assert.ThrowsAsync( expectedGroupDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -153,10 +145,6 @@ await Assert.ThrowsAsync( expectedGroupServiceException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteGroupAsync(It.IsAny()), - Times.Never()); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exception.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exception.Modify.cs index 5f5df766..49f8bae5 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exception.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exception.Modify.cs @@ -56,12 +56,6 @@ public async Task ShouldThrowCriticalDependencyExceptionOnModifyIfSqlErrorOccurs this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs(expectedPostImpressionDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectPostImpressionByIdAsync(postId, profileId), Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.UpdatePostImpressionAsync(somePostImpression), Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -165,8 +159,8 @@ public async Task ShouldThrowDependencyValidationExceptionOnModifyIfDatabaseUpda broker.LogError(It.Is(SameExceptionAs( expectedPostImpressionDependencyValidationException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.Add.cs index 1b998fdd..71417bd5 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.Add.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedPostImpressionDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -103,19 +99,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedPostImpressionDependencyValidationException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyExceptionOnAddIfDatabaseUpdateErrorOccursAndLogItAsync() @@ -152,19 +144,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedPostImpressionDependencyException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async void ShouldThrowDependencyValidationExceptionOnAddIfReferenceErrorOccursAndLogItAsync() @@ -208,10 +196,6 @@ await Assert.ThrowsAsync( expectedPostImpressionDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -250,18 +234,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedPostImpressionServiceException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } } } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RemoveById.cs index ad2f661d..2fc378d0 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RemoveById.cs @@ -54,7 +54,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionServiceException))), Times.Once); + expectedPostImpressionServiceException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -98,7 +99,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( - expectedPostImpressionDependencyException))), Times.Once); + expectedPostImpressionDependencyException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -145,10 +147,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionDependencyValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.DeletePostImpressionAsync(It.IsAny()), Times.Never); + expectedPostImpressionDependencyValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RetrieveAll.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RetrieveAll.cs index 98b54b69..b5ee5e74 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RetrieveAll.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Exceptions.RetrieveAll.cs @@ -45,7 +45,8 @@ public void ShouldThrowCriticalDependencyExceptionOnRetrieveAllWhenSqlExceptionO this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( - expectedPostImpressionDependencyException))), Times.Once); + expectedPostImpressionDependencyException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -84,7 +85,8 @@ public void ShouldThrowServiceExceptionOnRetrieveAllIfServiceErrorOccursAndLogIt this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionServiceException))), Times.Once); + expectedPostImpressionServiceException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.Modify.cs index 99363d1a..3e601c49 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.Modify.cs @@ -51,10 +51,12 @@ public async Task ShouldModifyPostImpressionAsync() broker.GetCurrentDateTimeOffset(), Times.Once); this.storageBrokerMock.Verify(broker => - broker.SelectPostImpressionByIdAsync(postId, profileId), Times.Once); + broker.SelectPostImpressionByIdAsync(postId, profileId), + Times.Once); this.storageBrokerMock.Verify(broker => - broker.UpdatePostImpressionAsync(inputPostImpression), Times.Once); + broker.UpdatePostImpressionAsync(inputPostImpression), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RemoveById.cs index 582b15aa..e85c982a 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RemoveById.cs @@ -44,10 +44,12 @@ public async Task ShouldRemovePostImpressionByIdAsync() actualPostImpression.Should().BeEquivalentTo(expectedPostImpression); this.storageBrokerMock.Verify(broker => - broker.SelectPostImpressionByIdAsync(inputPostId, inputProfileId), Times.Once()); + broker.SelectPostImpressionByIdAsync(inputPostId, inputProfileId), + Times.Once()); this.storageBrokerMock.Verify(broker => - broker.DeletePostImpressionAsync(storagePostImpression), Times.Once()); + broker.DeletePostImpressionAsync(storagePostImpression), + Times.Once()); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RetrieveAll.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RetrieveAll.cs index 95495aa1..f03e6f71 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RetrieveAll.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Logic.RetrieveAll.cs @@ -33,7 +33,8 @@ public void ShouldReturnPostImpressions() actualPostImpressions.Should().BeEquivalentTo(expectedPostImpressions); this.storageBrokerMock.Verify(broker => - broker.SelectAllPostImpressions(), Times.Once); + broker.SelectAllPostImpressions(), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validation.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validation.Modify.cs index 01a33c31..63e84b5e 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validation.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validation.Modify.cs @@ -39,10 +39,8 @@ await Assert.ThrowsAsync( expectedPostValidationException); this.loggingBrokerMock.Verify(broker => - broker.LogError(It.Is(SameExceptionAs(expectedPostValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.UpdatePostImpressionAsync(nullPostImpression), Times.Never); + broker.LogError(It.Is(SameExceptionAs(expectedPostValidationException))), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -97,14 +95,13 @@ await Assert.ThrowsAsync( expectedPostImpressionValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.UpdatePostImpressionAsync(invalidPostImpression), Times.Never); + expectedPostImpressionValidationException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -142,15 +139,13 @@ public async Task ShouldThrowValidationExceptionOnModifyIfUpdatedDateIsSameAsCre expectedPostImpressionValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.SelectPostImpressionByIdAsync( - invalidPostImpression.PostId, invalidPostImpression.ProfileId), Times.Never); + expectedPostImpressionValidationException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -191,14 +186,13 @@ await Assert.ThrowsAsync( expectedPostImpressionValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.SelectPostImpressionByIdAsync(It.IsAny(), It.IsAny()), Times.Never); + expectedPostImpressionValidationException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -245,14 +239,17 @@ public async Task ShouldThrowValidationExceptionOnModifyIfPostImpressionDoesNotE this.storageBrokerMock.Verify(broker => broker.SelectPostImpressionByIdAsync( nonExistPostImpression.PostId, - nonExistPostImpression.ProfileId), Times.Once); + nonExistPostImpression.ProfileId), + Times.Once); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); + expectedPostImpressionValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -304,14 +301,17 @@ public async Task ShouldThrowValidationExceptionOnModifyIfStorageCreatedDateNotS this.storageBrokerMock.Verify(broker => broker.SelectPostImpressionByIdAsync(invalidPostImpression.PostId, - invalidPostImpression.ProfileId), Times.Once); + invalidPostImpression.ProfileId), + Times.Once); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); + expectedPostImpressionValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -355,15 +355,18 @@ public async Task ShouldThrowValidationExceptionOnModifyIfStorageUpdatedDateSame expectedPostImpressionValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); + expectedPostImpressionValidationException))), + Times.Once); this.storageBrokerMock.Verify(broker => broker.SelectPostImpressionByIdAsync( - invalidPostImpression.PostId, invalidPostImpression.ProfileId), Times.Once); + invalidPostImpression.PostId, invalidPostImpression.ProfileId), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.Add.cs index decf9017..fdd71aa9 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.Add.cs @@ -112,10 +112,6 @@ await Assert.ThrowsAsync( expectedPostImpressionValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(invalidPostImpression), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -168,10 +164,6 @@ await Assert.ThrowsAsync( expectedPostImpressionValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -227,10 +219,6 @@ await Assert.ThrowsAsync( expectedPostImpressionValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -268,14 +256,13 @@ public async Task ShouldThrowValidationExceptionOnAddIfEnumsAreInvalidAndLogItAs expectedPostImpressionValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once()); + broker.GetCurrentDateTimeOffset(), + Times.Once()); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.InsertPostImpressionAsync(It.IsAny()), Times.Never); + expectedPostImpressionValidationException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RemoveById.cs index 0a290c2d..8847a6cb 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RemoveById.cs @@ -47,15 +47,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.SelectPostImpressionByIdAsync(postImpression.PostId, postImpression.ProfileId), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.DeletePostImpressionAsync( - It.IsAny()), Times.Never); + expectedPostImpressionValidationException))), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -100,10 +93,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostImpressionValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.DeletePostImpressionAsync(It.IsAny()), Times.Never); + expectedPostImpressionValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RetrieveById.cs index a0743cc6..d450aca3 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostImpressions/PostImpressionServiceTests.Validations.RetrieveById.cs @@ -52,10 +52,6 @@ await Assert.ThrowsAsync( expectedPostImpressionValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectPostImpressionByIdAsync(invalidPostId, invalidProfileId), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exception.RetrieveAll.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exception.RetrieveAll.cs index 5110ee2d..4cdf3d7d 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exception.RetrieveAll.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exception.RetrieveAll.cs @@ -41,11 +41,13 @@ public void ShouldThrowCriticalDependencyExceptionOnRetrieveAllWhenSqlExceptionO expectedPostReportDependencyException); this.storageBrokerMock.Verify(broker => - broker.SelectAllPostReports(), Times.Once); + broker.SelectAllPostReports(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( - expectedPostReportDependencyException))), Times.Once); + expectedPostReportDependencyException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -79,11 +81,13 @@ public void ShouldThrowServiceExceptionOnRetrieveAllIfServiceErrorOccursAndLogIt actualPostReportServiceException.Should().BeEquivalentTo(expectedPostReportServiceException); this.storageBrokerMock.Verify(broker => - broker.SelectAllPostReports(), Times.Once); + broker.SelectAllPostReports(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportServiceException))), Times.Once); + expectedPostReportServiceException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.Add.cs index 0f33ad66..0654805d 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.Add.cs @@ -47,11 +47,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportDependencyException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( - expectedPostReportDependencyException))), Times.Once); + expectedPostReportDependencyException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -88,11 +90,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportDependencyValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportDependencyValidationException))), Times.Once); + expectedPostReportDependencyValidationException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -128,11 +132,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportDependencyValidation); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportDependencyValidation))), Times.Once); + expectedPostReportDependencyValidation))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -168,11 +174,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportServiceException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportServiceException))), Times.Once); + expectedPostReportServiceException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.RetrieveById.cs index 15424efb..122f3540 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Exceptions.RetrieveById.cs @@ -46,11 +46,13 @@ await Assert.ThrowsAsync( expectedPostReportDependencyException); this.storageBrokerMock.Verify(broker => - broker.SelectPostReportByIdAsync(It.IsAny()), Times.Once); + broker.SelectPostReportByIdAsync(It.IsAny()), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( - expectedPostReportDependencyException))), Times.Once); + expectedPostReportDependencyException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -87,11 +89,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportServiceException); this.storageBrokerMock.Verify(broker => - broker.SelectPostReportByIdAsync(It.IsAny()), Times.Once); + broker.SelectPostReportByIdAsync(It.IsAny()), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportServiceException))), Times.Once); + expectedPostReportServiceException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.Add.cs index b638bd88..c907904a 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.Add.cs @@ -40,10 +40,12 @@ public async Task ShouldAddPostReportAsync() actualPostReport.Should().BeEquivalentTo(expectedPostReport); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.storageBrokerMock.Verify(broker => - broker.InsertPostReportAsync(inputPostReport), Times.Once); + broker.InsertPostReportAsync(inputPostReport), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.RetrieveById.cs index da348fef..83a47177 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.RetrieveById.cs @@ -37,7 +37,8 @@ public async Task ShouldRetrievePostReportByIdAsync() actualPostReport.Should().BeEquivalentTo(expectedPostReport); this.storageBrokerMock.Verify(broker => - broker.SelectPostReportByIdAsync(It.IsAny()), Times.Once); + broker.SelectPostReportByIdAsync(It.IsAny()), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.cs index a4d3b907..2ea88913 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Logic.cs @@ -32,7 +32,8 @@ public void ShouldRetrieveAllPostReports() actualPostReport.Should().BeEquivalentTo(expectedPostReport); this.storageBrokerMock.Verify(broker => - broker.SelectAllPostReports(), Times.Once); + broker.SelectAllPostReports(), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validation.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validation.Add.cs index 019c3b75..94e380d9 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validation.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validation.Add.cs @@ -39,7 +39,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportValidationException))), Times.Once); + expectedPostReportValidationException))), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -101,10 +102,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.InsertPostReportAsync(It.IsAny()), Times.Never); + expectedPostReportValidationException))), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -144,14 +143,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.InsertPostReportAsync(It.IsAny()), Times.Never); + expectedPostReportValidationException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); @@ -193,14 +191,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportValidationException); this.dateTimeBrokerMock.Verify(broker => - broker.GetCurrentDateTimeOffset(), Times.Once); + broker.GetCurrentDateTimeOffset(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.InsertPostReportAsync(It.IsAny()), Times.Never); + expectedPostReportValidationException))), + Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validations.RetrieveById.cs index c5f0009b..7b877cf2 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/PostReports/PostReportServiceTests.Validations.RetrieveById.cs @@ -44,10 +44,8 @@ await Assert.ThrowsAsync( this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportValidationException))), Times.Once); - - this.storageBrokerMock.Verify(broker => - broker.SelectPostReportByIdAsync(It.IsAny()), Times.Never); + expectedPostReportValidationException))), + Times.Once); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -84,11 +82,13 @@ await Assert.ThrowsAsync( .BeEquivalentTo(expectedPostReportValidationException); this.storageBrokerMock.Verify(broker => - broker.SelectPostReportByIdAsync(It.IsAny()), Times.Once()); + broker.SelectPostReportByIdAsync(It.IsAny()), + Times.Once()); this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( - expectedPostReportValidationException))), Times.Once); + expectedPostReportValidationException))), + Times.Once); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Add.cs index 01999bf6..a92ef865 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Add.cs @@ -51,18 +51,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( expectedPostDependencyException))), Times.Once); this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -102,19 +98,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedPostDependencyValidationException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyExceptionOnAddIfDatabaseUpdateErrorOccursAndLogItAsync() @@ -156,10 +148,6 @@ await Assert.ThrowsAsync( expectedPostDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -202,18 +190,14 @@ await Assert.ThrowsAsync(() => broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedPostServiceException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } } } \ No newline at end of file diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Modify.cs index 1f2dbc7d..47d75ad3 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.Modify.cs @@ -53,23 +53,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectPostByIdAsync(postId), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( expectedPostDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdatePostAsync(somePost), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyExceptionOnModifyIfDatabaseUpdateExceptionOccursAndLogItAsync() diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.RemoveById.cs index 6f063778..d68f5d5f 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Exceptions.RemoveById.cs @@ -58,10 +58,6 @@ await Assert.ThrowsAsync( expectedPostDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeletePostAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validation.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validation.Modify.cs index 46c3dd21..2b33470a 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validation.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validation.Modify.cs @@ -42,10 +42,6 @@ await Assert.ThrowsAsync( expectedPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdatePostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -108,10 +104,6 @@ public async Task ShouldThrowValidationExceptionOnModifyIfPostIsInvalidAndLogItA expectedPostValidationException))), Times.Once()); - this.storageBrokerMock.Verify(broker => - broker.UpdatePostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -157,10 +149,6 @@ await Assert.ThrowsAsync( expectedPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectPostByIdAsync(invalidPost.Id), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -209,10 +197,6 @@ await Assert.ThrowsAsync( expectedPostValidatonException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectPostByIdAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.Add.cs index 323d73cd..321f329b 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.Add.cs @@ -104,10 +104,6 @@ await Assert.ThrowsAsync( expectedPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); } @@ -159,10 +155,6 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -218,10 +210,6 @@ await Assert.ThrowsAsync( expectedPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertPostAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RemoveById.cs index 094330de..b1f66239 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RemoveById.cs @@ -47,10 +47,6 @@ await Assert.ThrowsAsync( expectedPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeletePostAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -95,10 +91,6 @@ await Assert.ThrowsAsync( expectedPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeletePostAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RetrieveById.cs index 5fa7e218..97c38721 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Posts/PostServiceTests.Validations.RetrieveById.cs @@ -47,10 +47,6 @@ await Assert.ThrowsAsync( expectedPostValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectPostByIdAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Add.cs index 8bb62eb2..b6733d19 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Add.cs @@ -57,10 +57,6 @@ await Assert.ThrowsAsync( expectedProfileDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -108,10 +104,6 @@ await Assert.ThrowsAsync( expectedProfileDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -159,10 +151,6 @@ await Assert.ThrowsAsync( expectedProfileDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -208,10 +196,6 @@ await Assert.ThrowsAsync( expectedProfileDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -255,10 +239,6 @@ await Assert.ThrowsAsync( expectedProfileServiceException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Modify.cs index b455615d..df34bb2a 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.Modify.cs @@ -51,23 +51,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(randomProfile.Id), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(randomProfile), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( expectedProfileDependencyException))), Times.Once); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async void ShouldThrowValidationExceptionOnModifyIfReferenceErrorOccursAndLogItAsync() @@ -114,22 +106,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(foreignKeyConflictedProfile.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs(profileDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(foreignKeyConflictedProfile), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyExceptionOnModifyIfDatabaseUpdateExceptionOccursAndLogItAsync() @@ -164,23 +148,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(randomProfile.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedProfileDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(randomProfile), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowDependencyValidationExceptionOnModifyIfDatabaseUpdateConcurrencyErrorOccursAndLogItAsync() @@ -215,23 +191,15 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(randomProfile.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedProfileDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(randomProfile), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowServiceExceptionOnModifyIfServiceErrorOccursAndLogItAsync() @@ -266,22 +234,14 @@ await Assert.ThrowsAsync( broker.GetCurrentDateTimeOffset(), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(randomProfile.Id), - Times.Never); - this.loggingBrokerMock.Verify(broker => broker.LogError(It.Is(SameExceptionAs( expectedProfileServiceException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(randomProfile), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } } } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RemoveById.cs index faa880e1..310f711a 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RemoveById.cs @@ -55,10 +55,6 @@ await Assert.ThrowsAsync( expectedProfileDependencyException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteProfileAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -104,10 +100,6 @@ await Assert.ThrowsAsync( expectedProfileDependencyValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteProfileAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); @@ -151,13 +143,9 @@ await Assert.ThrowsAsync( expectedProfileServiceException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteProfileAsync(It.IsAny()), - Times.Never()); - - this.storageBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - } + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + } } } diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RetrieveAll.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RetrieveAll.cs index 236a4533..f332a68b 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RetrieveAll.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Exceptions.RetrieveAll.cs @@ -43,7 +43,8 @@ public void ShouldThrowCriticalDependencyExceptionOnRetrieveAllWhenSqlExceptionO .BeEquivalentTo(expectedProfileDependencyException); this.storageBrokerMock.Verify(broker => - broker.SelectAllProfiles()); + broker.SelectAllProfiles(), + Times.Once); this.loggingBrokerMock.Verify(broker => broker.LogCritical(It.Is(SameExceptionAs( diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Add.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Add.cs index 6a2d6fb5..086bcdf8 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Add.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Add.cs @@ -43,12 +43,8 @@ await Assert.ThrowsAsync( expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(invalidProfile), - Times.Never); - - this.dateTimeBrokerMock.VerifyNoOtherCalls(); - this.loggingBrokerMock.VerifyNoOtherCalls(); + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); } @@ -113,12 +109,9 @@ await Assert.ThrowsAsync( expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(invalidProfile), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); } [Fact] @@ -163,13 +156,10 @@ await Assert.ThrowsAsync(() => expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(It.IsAny()), - Times.Never); - - this.loggingBrokerMock.VerifyNoOtherCalls(); - this.storageBrokerMock.VerifyNoOtherCalls(); - } + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + } [Theory] [MemberData(nameof(MinutesBeforeOrAfter))] @@ -221,10 +211,6 @@ await Assert.ThrowsAsync( expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.InsertProfileAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Modify.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Modify.cs index 6c33f079..adf6e667 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Modify.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.Modify.cs @@ -42,14 +42,6 @@ await Assert.ThrowsAsync( expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(It.IsAny()), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -128,10 +120,6 @@ await Assert.ThrowsAsync( expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -178,10 +166,6 @@ await Assert.ThrowsAsync( expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(invalidProfile.Id), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); @@ -232,14 +216,6 @@ await Assert.ThrowsAsync( expectedProfileValidatonException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(It.IsAny()), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.UpdateProfileAsync(It.IsAny()), - Times.Never); - this.dateTimeBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RemoveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RemoveById.cs index 089549df..d7623e13 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RemoveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RemoveById.cs @@ -48,14 +48,10 @@ await Assert.ThrowsAsync(() => expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(It.IsAny()), - Times.Never); - - this.storageBrokerMock.Verify(broker => - broker.DeleteProfileAsync(It.IsAny()), - Times.Never); - } + this.loggingBrokerMock.VerifyNoOtherCalls(); + this.storageBrokerMock.VerifyNoOtherCalls(); + this.dateTimeBrokerMock.VerifyNoOtherCalls(); + } [Fact] public async Task ShouldThrowNotFoundExceptionOnRemoveProfileByIdIsNotFounfAndLogItAsync() @@ -95,10 +91,6 @@ await Assert.ThrowsAsync(() => expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.DeleteProfileAsync(It.IsAny()), - Times.Never); - this.storageBrokerMock.VerifyNoOtherCalls(); this.loggingBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); diff --git a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RetrieveById.cs b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RetrieveById.cs index 5c624f9a..10306bbb 100644 --- a/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RetrieveById.cs +++ b/Taarafo.Core.Tests.Unit/Services/Foundations/Profiles/ProfileServiceTests.Validations.RetrieveById.cs @@ -47,10 +47,6 @@ await Assert.ThrowsAsync( expectedProfileValidationException))), Times.Once); - this.storageBrokerMock.Verify(broker => - broker.SelectProfileByIdAsync(It.IsAny()), - Times.Never); - this.loggingBrokerMock.VerifyNoOtherCalls(); this.storageBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls();