Skip to content

Commit 5170c71

Browse files
committed
test: CollectionMemberClassWithSuppression
1 parent e978a8a commit 5170c71

File tree

4 files changed

+214
-0
lines changed

4 files changed

+214
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// <auto-generated/>
2+
// This code was generated by the library M31.FluentAPI.
3+
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
4+
5+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
6+
#nullable enable
7+
8+
using System.Collections.Generic;
9+
10+
namespace M31.FluentApi.Tests.CodeGeneration.TestClasses.Abstract.CollectionMemberClassWithSuppression;
11+
12+
public class CreateStudent :
13+
CreateStudent.ICreateStudent,
14+
CreateStudent.IWhoseFriendsAre,
15+
CreateStudent.IWithPets,
16+
CreateStudent.IWithBackpackContent
17+
{
18+
private readonly Student student;
19+
20+
private CreateStudent()
21+
{
22+
student = new Student();
23+
}
24+
25+
public static ICreateStudent InitialStep()
26+
{
27+
return new CreateStudent();
28+
}
29+
30+
public static IWithPets WhoseFriendsAre(System.Collections.Generic.List<string> friends)
31+
{
32+
CreateStudent createStudent = new CreateStudent();
33+
createStudent.student.Friends = friends;
34+
return createStudent;
35+
}
36+
37+
public static IWithPets WhoseFriendsAre(params string[] friends)
38+
{
39+
CreateStudent createStudent = new CreateStudent();
40+
createStudent.student.Friends = new List<string>(friends);
41+
return createStudent;
42+
}
43+
44+
IWithPets IWhoseFriendsAre.WhoseFriendsAre(System.Collections.Generic.List<string> friends)
45+
{
46+
student.Friends = friends;
47+
return this;
48+
}
49+
50+
IWithPets IWhoseFriendsAre.WhoseFriendsAre(params string[] friends)
51+
{
52+
student.Friends = new List<string>(friends);
53+
return this;
54+
}
55+
56+
IWithBackpackContent IWithPets.WithPets(params string[] pets)
57+
{
58+
student.Pets = pets;
59+
return this;
60+
}
61+
62+
Student IWithBackpackContent.WithBackpackContent(System.Collections.Generic.HashSet<string> backpackContent)
63+
{
64+
student.BackpackContent = backpackContent;
65+
return student;
66+
}
67+
68+
Student IWithBackpackContent.WithBackpackContent(params string[] backpackContent)
69+
{
70+
student.BackpackContent = new HashSet<string>(backpackContent);
71+
return student;
72+
}
73+
74+
public interface ICreateStudent : IWhoseFriendsAre
75+
{
76+
}
77+
78+
public interface IWhoseFriendsAre
79+
{
80+
IWithPets WhoseFriendsAre(System.Collections.Generic.List<string> friends);
81+
82+
IWithPets WhoseFriendsAre(params string[] friends);
83+
}
84+
85+
public interface IWithPets
86+
{
87+
IWithBackpackContent WithPets(params string[] pets);
88+
}
89+
90+
public interface IWithBackpackContent
91+
{
92+
Student WithBackpackContent(System.Collections.Generic.HashSet<string> backpackContent);
93+
94+
Student WithBackpackContent(params string[] backpackContent);
95+
}
96+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// <auto-generated/>
2+
// This code was generated by the library M31.FluentAPI.
3+
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
4+
5+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
6+
#nullable enable
7+
8+
using System.Collections.Generic;
9+
10+
namespace M31.FluentApi.Tests.CodeGeneration.TestClasses.Abstract.CollectionMemberClassWithSuppression;
11+
12+
public class CreateStudent :
13+
CreateStudent.ICreateStudent,
14+
CreateStudent.IWhoseFriendsAre,
15+
CreateStudent.IWithPets,
16+
CreateStudent.IWithBackpackContent
17+
{
18+
private readonly Student student;
19+
20+
private CreateStudent()
21+
{
22+
student = new Student();
23+
}
24+
25+
public static ICreateStudent InitialStep()
26+
{
27+
return new CreateStudent();
28+
}
29+
30+
public static IWithPets WhoseFriendsAre(System.Collections.Generic.List<string> friends)
31+
{
32+
CreateStudent createStudent = new CreateStudent();
33+
createStudent.student.Friends = friends;
34+
return createStudent;
35+
}
36+
37+
public static IWithPets WhoseFriendsAre(params string[] friends)
38+
{
39+
CreateStudent createStudent = new CreateStudent();
40+
createStudent.student.Friends = new List<string>(friends);
41+
return createStudent;
42+
}
43+
44+
IWithPets IWhoseFriendsAre.WhoseFriendsAre(System.Collections.Generic.List<string> friends)
45+
{
46+
student.Friends = friends;
47+
return this;
48+
}
49+
50+
IWithPets IWhoseFriendsAre.WhoseFriendsAre(params string[] friends)
51+
{
52+
student.Friends = new List<string>(friends);
53+
return this;
54+
}
55+
56+
IWithBackpackContent IWithPets.WithPets(params string[] pets)
57+
{
58+
student.Pets = pets;
59+
return this;
60+
}
61+
62+
Student IWithBackpackContent.WithBackpackContent(System.Collections.Generic.HashSet<string> backpackContent)
63+
{
64+
student.BackpackContent = backpackContent;
65+
return student;
66+
}
67+
68+
Student IWithBackpackContent.WithBackpackContent(params string[] backpackContent)
69+
{
70+
student.BackpackContent = new HashSet<string>(backpackContent);
71+
return student;
72+
}
73+
74+
public interface ICreateStudent : IWhoseFriendsAre
75+
{
76+
}
77+
78+
public interface IWhoseFriendsAre
79+
{
80+
IWithPets WhoseFriendsAre(System.Collections.Generic.List<string> friends);
81+
82+
IWithPets WhoseFriendsAre(params string[] friends);
83+
}
84+
85+
public interface IWithPets
86+
{
87+
IWithBackpackContent WithPets(params string[] pets);
88+
}
89+
90+
public interface IWithBackpackContent
91+
{
92+
Student WithBackpackContent(System.Collections.Generic.HashSet<string> backpackContent);
93+
94+
Student WithBackpackContent(params string[] backpackContent);
95+
}
96+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Non-nullable member is uninitialized
2+
#pragma warning disable CS8618
3+
// ReSharper disable All
4+
5+
using System.Collections.Generic;
6+
using M31.FluentApi.Attributes;
7+
8+
namespace M31.FluentApi.Tests.CodeGeneration.TestClasses.Abstract.CollectionMemberClassWithSuppression;
9+
10+
[FluentApi]
11+
public class Student
12+
{
13+
[FluentCollection(0, "Friend", "WhoseFriendsAre", null, null)]
14+
public List<string> Friends { get; set; }
15+
16+
[FluentCollection(1, "Pet", withItem: null, withZeroItems: null)]
17+
public string[] Pets { get; set; }
18+
19+
[FluentCollection(2, "BackpackContent", "WithBackpackContent", null, null)]
20+
public HashSet<string> BackpackContent { get; set; }
21+
}

src/M31.FluentApi.Tests/CodeGeneration/TestDataProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ internal class TestDataProvider : IEnumerable<object[]>
1313
new object[] { "Abstract", "AliasNamespaceClass", "Student" },
1414
new object[] { "Abstract", "CollectionInterfaceMemberClass", "Student" },
1515
new object[] { "Abstract", "CollectionMemberClass", "Student" },
16+
new object[] { "Abstract", "CollectionMemberClassWithSuppression", "Student" },
1617
new object[] { "Abstract", "CollectionNullableArrayClass", "Student" },
1718
new object[] { "Abstract", "ContinueWithAfterCompoundClass", "Student" },
1819
new object[] { "Abstract", "ContinueWithInForkClass", "Student" },

0 commit comments

Comments
 (0)