Skip to content

Commit 29d70d4

Browse files
committed
remove try catch around assert, obfuscates stacktrace. Added more debug information on crudtestbase isvalid assertations
1 parent 9600cfd commit 29d70d4

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/Tests/Framework/CrudTestBase.cs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ protected async Task AssertOnAllResponses<TResponse>(LazyResponses responses, Ac
110110
var response = kv.Value as TResponse;
111111
if (response == null)
112112
throw new Exception($"{kv.Value.GetType()} is not expected response type {typeof(TResponse)}");
113-
try
114-
{
113+
//try
114+
//{
115115
assert(response);
116-
}
116+
//}
117117
#pragma warning disable 7095
118-
catch (Exception ex) when (false)
118+
//catch (Exception ex) when (false)
119119
#pragma warning restore 7095
120-
{
121-
throw new Exception($"asserting over the response from: {kv.Key} failed: {ex.Message}", ex);
122-
}
120+
//{
121+
// throw new Exception($"asserting over the response from: {kv.Key} failed: {ex.Message}", ex);
122+
//}
123123
}
124124
}
125125

@@ -147,19 +147,24 @@ protected async Task AssertOnGetAfterDelete(Action<TReadResponse> assert)
147147
protected virtual void ExpectAfterCreate(TReadResponse response) { }
148148
protected virtual void ExpectAfterUpdate(TReadResponse response) { }
149149

150-
[I] protected virtual async Task CreateCallIsValid() => await this.AssertOnCreate(r => r.IsValid.Should().Be(true));
150+
[I] protected virtual async Task CreateCallIsValid() =>
151+
await this.AssertOnCreate(r => r.IsValid.Should().Be(true, "{0}", r.DebugInformation));
151152
[I] protected virtual async Task GetAfterCreateIsValid() => await this.AssertOnGetAfterCreate(r => {
152-
r.IsValid.Should().Be(true);
153+
r.IsValid.Should().Be(true, "{0}", r.DebugInformation);
153154
ExpectAfterCreate(r);
154155
});
155156

156-
[I] protected virtual async Task UpdateCallIsValid() => await this.AssertOnUpdate(r => r.IsValid.Should().Be(true));
157+
[I] protected virtual async Task UpdateCallIsValid()
158+
=> await this.AssertOnUpdate(r => r.IsValid.Should().Be(true, "{0}", r.DebugInformation));
159+
157160
[I] protected virtual async Task GetAfterUpdateIsValid() => await this.AssertOnGetAfterUpdate(r => {
158-
r.IsValid.Should().Be(true);
161+
r.IsValid.Should().Be(true, "{0}", r.DebugInformation);
159162
ExpectAfterUpdate(r);
160163
});
161164

162-
[I] protected virtual async Task DeleteCallIsValid() => await this.AssertOnDelete(r => r.IsValid.Should().Be(true));
163-
[I] protected virtual async Task GetAfterDeleteIsValid() => await this.AssertOnGetAfterDelete(r => r.IsValid.Should().Be(false));
165+
[I] protected virtual async Task DeleteCallIsValid() =>
166+
await this.AssertOnDelete(r => r.IsValid.Should().Be(true, "{0}", r.DebugInformation));
167+
[I] protected virtual async Task GetAfterDeleteIsValid() => await
168+
this.AssertOnGetAfterDelete(r => r.IsValid.Should().Be(false, "{0}", r.DebugInformation));
164169
}
165170
}

0 commit comments

Comments
 (0)