-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADSECGH-92 coverage for AdSecProfiles.cs #123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify asserts
private IProfile[] profiles = {
GetAPerimeterProfile(),
GetARectangleProfile()
};
[Fact]
public void CheckProfiles_NotNull() {
foreach (var profile in profiles) {
var result = AdSecProfiles.CreateProfile(profile);
Assert.NotNull(result);
}
}
[Fact]
public void CheckProfiles_HaveTheRightType() {
foreach (var profile in profiles) {
var result = AdSecProfiles.CreateProfile(profile);
Assert.Equal($"I{profile.GetType().Name}_Implementation", result.GetType().Name);
}
}
private static void NotNullAndRightType(Oasys.Profiles.IProfile result, IProfile profile) {
Assert.NotNull(result);
Assert.Equal($"I{profile.GetType().Name}_Implementation", result.GetType().Name);
}
Simplify Gets
private static SheetPileProfile GetASheetPileProfile() {
var rotationInDegrees = new Angle(0, DefaultUnits.AngleUnit);
var lengthOne = LengthOne();
return new SheetPileProfile() {
Rotation = rotationInDegrees,
BottomFlangeWidth = lengthOne,
FlangeThickness = lengthOne,
Depth = lengthOne,
TopFlangeWidth = lengthOne,
WebThickness = lengthOne,
Width = lengthOne,
};
}
private static Length LengthOne() {
return new Length(1, DefaultUnits.LengthUnitGeometry);
}
~
- Rename the Method to "GetA"
- Adjust the Units to use the default Units
- Extract the Unit of One in a resulable method
- Reuse this one for all values, do not differentiate unless it crashes
- Move the class that has the "GetA" methods to another file, which we will be referencing on our tests whenever we need a profile.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #123 +/- ##
=======================================
+ Coverage 43.7% 44.5% +0.8%
=======================================
Files 95 95
Lines 6656 6667 +11
Branches 867 869 +2
=======================================
+ Hits 2912 2973 +61
+ Misses 3665 3618 -47
+ Partials 79 76 -3
|
No description provided.