-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:tmail_ui_user/main/exceptions/remote_exception.dart'; | ||
|
||
bool isNotBadCredentialsExceptionUseIsNotOperator(dynamic exception) { | ||
return exception is! BadCredentialsException; | ||
} | ||
|
||
bool isBadCredentialsExceptionUseIsOperator(dynamic exception) { | ||
return exception is BadCredentialsException; | ||
} | ||
|
||
bool isBadCredentialsExceptionUseNotIsOperator(dynamic exception) { | ||
return exception !is BadCredentialsException; | ||
} | ||
|
||
void main() { | ||
group('is! operator unit test', () { | ||
test('should return true when exception is not a BadCredentialsException', () { | ||
// Arrange | ||
const connectionError = ConnectionError(); | ||
|
||
// Act | ||
final result = isNotBadCredentialsExceptionUseIsNotOperator(connectionError); | ||
|
||
// Assert | ||
expect(result, true); | ||
}); | ||
|
||
test('should return false when exception is a BadCredentialsException', () { | ||
// Arrange | ||
const badCredentialsException = BadCredentialsException(); | ||
|
||
// Act | ||
final result = isNotBadCredentialsExceptionUseIsNotOperator(badCredentialsException); | ||
|
||
// Assert | ||
expect(result, false); | ||
}); | ||
}); | ||
|
||
group('is operator unit test', () { | ||
test('should return true when exception is a BadCredentialsException', () { | ||
// Arrange | ||
const badCredentialsException = BadCredentialsException(); | ||
|
||
// Act | ||
final result = isBadCredentialsExceptionUseIsOperator(badCredentialsException); | ||
|
||
// Assert | ||
expect(result, true); | ||
}); | ||
|
||
test('should return false when exception is not a BadCredentialsException', () { | ||
// Arrange | ||
const connectionError = ConnectionError(); | ||
|
||
// Act | ||
final result = isBadCredentialsExceptionUseIsOperator(connectionError); | ||
|
||
// Assert | ||
expect(result, false); | ||
}); | ||
}); | ||
|
||
group('!is operator unit test', () { | ||
test('should return true when exception is a BadCredentialsException', () { | ||
// Arrange | ||
const badCredentialsException = BadCredentialsException(); | ||
|
||
// Act | ||
final result = isBadCredentialsExceptionUseNotIsOperator(badCredentialsException); | ||
|
||
// Assert | ||
expect(result, true); | ||
}); | ||
|
||
test('should return false when exception is not a BadCredentialsException', () { | ||
// Arrange | ||
const connectionError = ConnectionError(); | ||
|
||
// Act | ||
final result = isBadCredentialsExceptionUseNotIsOperator(connectionError); | ||
|
||
// Assert | ||
expect(result, false); | ||
}); | ||
}); | ||
} |