|
43 | 43 |
|
44 | 44 | namespace RFEM_Toolkit_Test.Comparer_Tests
|
45 | 45 | {
|
46 |
| - internal class Section |
| 46 | + internal class Section |
47 | 47 |
|
48 |
| - { |
| 48 | + { |
49 | 49 |
|
50 |
| - RFEM6Adapter adapter; |
51 |
| - ISectionProperty steelSection1; |
52 |
| - ISectionProperty steelSection2; |
53 |
| - ISectionProperty concreteSection0; |
54 |
| - ISectionProperty concreteSection1; |
55 |
| - ISectionProperty genericSectionGLTimber; |
56 |
| - ISectionProperty genericSectionSawnTimber; |
57 |
| - IProfile rectProfileGLTimber; |
58 |
| - IProfile circleProfileSawnTimber; |
59 |
| - IProfile concreteProfile0; |
60 |
| - IProfile concreteProfile1; |
| 50 | + RFEM6Adapter adapter; |
| 51 | + ISectionProperty steelSection1; |
| 52 | + ISectionProperty steelSection2; |
| 53 | + ISectionProperty steelSection3; |
| 54 | + ISectionProperty steelSection4; |
| 55 | + ISectionProperty concreteSection0; |
| 56 | + ISectionProperty concreteSection1; |
| 57 | + ISectionProperty concreteSection2; |
| 58 | + ISectionProperty concreteSection3; |
| 59 | + ISectionProperty genericSectionGLTimber; |
| 60 | + ISectionProperty genericSectionSawnTimber; |
| 61 | + IProfile rectProfileGLTimber; |
| 62 | + IProfile circleProfileSawnTimber; |
| 63 | + IProfile concreteProfile0; |
| 64 | + IProfile concreteProfile1; |
61 | 65 |
|
62 |
| - IMaterialFragment glulam; |
63 |
| - IMaterialFragment timberC; |
64 |
| - Concrete concrete0; |
65 |
| - Concrete concrete1; |
| 66 | + IMaterialFragment glulam; |
| 67 | + IMaterialFragment timberC; |
| 68 | + Concrete concrete0; |
| 69 | + Concrete concrete1; |
| 70 | + Concrete concrete01; |
| 71 | + Concrete concrete11; |
66 | 72 |
|
67 |
| - RFEMSectionComparer comparer; |
| 73 | + RFEMSectionComparer comparer; |
68 | 74 |
|
69 |
| - //[SetUp] |
70 |
| - //public void Setup() |
71 |
| - //{ |
72 |
| - |
73 |
| - //} |
| 75 | + //[SetUp] |
| 76 | + //public void Setup() |
| 77 | + //{ |
74 | 78 |
|
75 |
| - [OneTimeSetUp] |
76 |
| - public void InitializeRFEM6Adapter() |
77 |
| - { |
| 79 | + //} |
78 | 80 |
|
79 |
| - adapter = new RFEM6Adapter(true); |
80 |
| - comparer = new RFEMSectionComparer(); |
| 81 | + [OneTimeSetUp] |
| 82 | + public void InitializeRFEM6Adapter() |
| 83 | + { |
81 | 84 |
|
82 |
| - } |
| 85 | + adapter = new RFEM6Adapter(true); |
| 86 | + comparer = new RFEMSectionComparer(); |
83 | 87 |
|
84 |
| - [Test] |
85 |
| - public void StandardConcreteSections() |
86 |
| - { |
87 |
| - /***************************************************/ |
88 |
| - /**** Test Preparation ****/ |
89 |
| - /***************************************************/ |
90 |
| - concrete0 = BH.Engine.Library.Query.Match("Concrete", "C25/30", true, true).DeepClone() as Concrete; |
91 |
| - concrete1 = BH.Engine.Library.Query.Match("Concrete", "C45/55", true, true).DeepClone() as Concrete; |
| 88 | + } |
92 | 89 |
|
| 90 | + [Test] |
| 91 | + public void StandardConcreteSections() |
| 92 | + { |
| 93 | + /***************************************************/ |
| 94 | + /**** Arrange ****/ |
| 95 | + /***************************************************/ |
| 96 | + concrete0 = BH.Engine.Library.Query.Match("Concrete", "C25/30", true, true).DeepClone() as Concrete; |
| 97 | + concrete01 = BH.Engine.Library.Query.Match("Concrete", "C25/30", true, true).DeepClone() as Concrete; |
93 | 98 |
|
94 |
| - concreteProfile0 = BH.Engine.Spatial.Create.CircleProfile(0.2); |
95 |
| - concreteSection0 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile0, concrete0, "ConcreteSection1"); |
| 99 | + concrete1 = BH.Engine.Library.Query.Match("Concrete", "C45/55", true, true).DeepClone() as Concrete; |
| 100 | + concrete11 = BH.Engine.Library.Query.Match("Concrete", "C45/55", true, true).DeepClone() as Concrete; |
96 | 101 |
|
97 |
| - concreteProfile1 = BH.Engine.Spatial.Create.CircleProfile(0.5); |
98 |
| - concreteSection1 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile1, concrete1, "ConcreteSection2"); |
99 | 102 |
|
100 |
| - adapter.Push(new List<ISectionProperty>() { concreteSection0}); |
| 103 | + concreteProfile0 = BH.Engine.Spatial.Create.CircleProfile(0.2); |
| 104 | + concreteSection0 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile0, concrete0, "ConcreteSection1"); |
101 | 105 |
|
102 |
| - FilterRequest sectionFilter = new FilterRequest() { Type = typeof(ISectionProperty) }; |
103 |
| - var sectionsPulled = adapter.Pull(sectionFilter).Select(s => (ConcreteSection)s).ToList().First(); |
| 106 | + concreteProfile1 = BH.Engine.Spatial.Create.CircleProfile(0.5); |
| 107 | + concreteSection1 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile1, concrete1, "ConcreteSection2"); |
104 | 108 |
|
105 |
| - /***************************************************/ |
106 |
| - /**** Assertions ****/ |
107 |
| - /***************************************************/ |
| 109 | + adapter.Push(new List<ISectionProperty>() { concreteSection0 }); |
108 | 110 |
|
109 |
| - //Assert.IsTrue(comparer.Equals(sectionsPulled,ConcreteSection0)); |
| 111 | + FilterRequest sectionFilter = new FilterRequest() { Type = typeof(ISectionProperty) }; |
| 112 | + var sectionsPulled = adapter.Pull(sectionFilter).Select(s => (ConcreteSection)s).ToList().First(); |
110 | 113 |
|
| 114 | + /***************************************************/ |
| 115 | + /**** Asserti ****/ |
| 116 | + /***************************************************/ |
111 | 117 |
|
| 118 | + //Assert.IsTrue(comparer.Equals(sectionsPulled,ConcreteSection0)); |
112 | 119 |
|
113 |
| - } |
114 | 120 |
|
115 |
| - [Test] |
116 |
| - public void StandardSteelSections() |
117 |
| - { |
118 |
| - //TODO: Implement |
119 |
| - } |
120 | 121 |
|
121 |
| - [Test] |
122 |
| - public void GenericTimberSections() |
123 |
| - { |
124 |
| - //TODO: Implement |
125 |
| - } |
| 122 | + } |
126 | 123 |
|
127 |
| - [Test] |
128 |
| - public void GenericConcreteSections() |
129 |
| - { |
130 |
| - //TODO: Implement |
131 |
| - } |
| 124 | + [Test] |
| 125 | + public void StandardSteelSections() |
| 126 | + { |
132 | 127 |
|
133 | 128 |
|
134 |
| - } |
| 129 | + /***************************************************/ |
| 130 | + /**** Arrange ****/ |
| 131 | + /***************************************************/ |
| 132 | + |
| 133 | + steelSection1 = BH.Engine.Library.Query.Match("EU_SteelSections", "IPE 300", true, true).DeepClone() as ISectionProperty; |
| 134 | + steelSection2 = BH.Engine.Library.Query.Match("EU_SteelSections", "IPE 300", true, true).DeepClone() as ISectionProperty; |
| 135 | + |
| 136 | + adapter.Push(new List<ISectionProperty>(){steelSection1}); |
| 137 | + FilterRequest sectionFilter = new FilterRequest() { Type = typeof(ISectionProperty) }; |
| 138 | + var tst = adapter.Pull(sectionFilter); |
| 139 | + steelSection3 = adapter.Pull(sectionFilter).Select(s => (ISectionProperty)s).ToList().First(); |
| 140 | + |
| 141 | + steelSection4 = BH.Engine.Library.Query.Match("EU_SteelSections", "IPE 550", true, true).DeepClone() as ISectionProperty; |
| 142 | + |
| 143 | + /***************************************************/ |
| 144 | + /**** Act ****/ |
| 145 | + /***************************************************/ |
| 146 | + |
| 147 | + bool OrgSec1_Vs_OrgSec1 = comparer.Equals(steelSection1, steelSection1); |
| 148 | + bool OrgSec1_Vs_OrgSec2 = comparer.Equals(steelSection1, steelSection2); |
| 149 | + bool OrgSec1_Vs_PullSec3 = comparer.Equals(steelSection1, steelSection3); |
| 150 | + bool OrgSec1_Vs_OrgSec4 = comparer.Equals(steelSection1, steelSection4); |
| 151 | + |
| 152 | + |
| 153 | + /***************************************************/ |
| 154 | + /**** Assert ****/ |
| 155 | + /***************************************************/ |
| 156 | + |
| 157 | + //Checking Steel Section Agains it self |
| 158 | + Assert.IsTrue(OrgSec1_Vs_OrgSec1); |
| 159 | + |
| 160 | + // Checking Steel Section agains its Copy |
| 161 | + Assert.IsTrue(OrgSec1_Vs_OrgSec2); |
| 162 | + |
| 163 | + // Checking Steel Section agains its Push/Pulled version |
| 164 | + Assert.IsTrue(OrgSec1_Vs_PullSec3); |
| 165 | + |
| 166 | + // Checking Steel Sectin agains a differnt Steel Section |
| 167 | + Assert.IsTrue(!OrgSec1_Vs_OrgSec4); |
| 168 | + |
| 169 | + |
| 170 | + } |
| 171 | + |
| 172 | + [Test] |
| 173 | + public void GenericTimberSections() |
| 174 | + { |
| 175 | + //TODO: Implement |
| 176 | + } |
| 177 | + |
| 178 | + [Test] |
| 179 | + public void GenericConcreteSections() |
| 180 | + { |
| 181 | + //TODO: Implement |
| 182 | + } |
| 183 | + |
| 184 | + |
| 185 | + } |
135 | 186 | }
|
136 | 187 |
|
0 commit comments