C# Client Library
A C# Client Library for the AnalyzeRe REST API
Test_Analysis.cs
Go to the documentation of this file.
1 using System;
2 using AnalyzeRe;
3 using AnalyzeRe.Analyses;
4 using AnalyzeRe.APITypes;
6 
7 #if MSTEST
8 using Microsoft.VisualStudio.TestTools.UnitTesting;
9 #elif NUNIT
10 using TestClass = NUnit.Framework.TestFixtureAttribute;
11 using TestMethod = NUnit.Framework.TestAttribute;
12 using TestCategory = NUnit.Framework.CategoryAttribute;
13 #endif
14 
15 namespace AnalyzeReTesting.Tests.Model
16 {
17  [TestClass]
18  [Obsolete("This tests a now obsolete class for backwards compatibility purposes.")]
20  {
21  protected override IResourceCollection<Analysis> collection_source => API.Analyses;
22  }
23 
24  [TestClass]
25  [Obsolete("This tests a now obsolete class for backwards compatibility purposes.")]
26  public sealed class TestSuite_Analysis_VendorPortfolioAnalysis : TestSuite_Analysis<VendorPortfolioAnalysis>
27  {
28  #region Set Up and Configuration
29  private const string TypeName = "VendorPortfolioAnalysis";
31  TestInjectableResource => Samples.Analysis_VendorPortfolioAnalysis;
32  #endregion Set Up and Configuration
33  }
34 
35  [TestClass]
36  [Obsolete("This tests a now obsolete class for backwards compatibility purposes.")]
37  public sealed class TestSuite_Analysis_VendorTreatyAnalysis : TestSuite_Analysis<VendorTreatyAnalysis>
38  {
39  #region Set Up and Configuration
40  private const string TypeName = "VendorTreatyAnalysis";
42  TestInjectableResource => Samples.Analysis_VendorTreatyAnalysis;
43  #endregion Set Up and Configuration
44  }
45 
47  [TestClass]
48  [Obsolete("This tests a now obsolete class for backwards compatibility purposes.")]
49  public abstract class TestSuite_Analysis<T> : BaseMutableResourceTestSuite<T> where T : Analysis
50  {
51  private const string TypeName = "Analysis";
52 
53  #region POST
54  #region agent
55  [TestMethod, TestCategory(TypeName)]
56  public virtual void Test_Analysis_POST_Agent_Null()
57  {
58  POST_Attribute_Null(a => a.agent);
59  }
60  [TestMethod, TestCategory(TypeName)]
62  {
63  POST_Reference_NullId(a => a.agent);
64  }
65  [TestMethod, TestCategory(TypeName)]
67  {
68  POST_Reference_EmptyStringId(a => a.agent);
69  }
70  [TestMethod, TestCategory(TypeName)]
72  {
73  POST_Reference_NonExistantId(a => a.agent);
74  }
75  #endregion agent
76 
77  #region host
78  [TestMethod, TestCategory(TypeName)]
79  public virtual void Test_Analysis_POST_Host_Null()
80  {
81  POST_Attribute_Null(a => a.host);
82  }
83  [TestMethod, TestCategory(TypeName)]
84  public virtual void Test_Analysis_POST_Host_Blank()
85  {
86  POST_StringAttribute_Empty(a => a.host);
87  }
88  #endregion host
89 
90  #region identifier
91  [TestMethod, TestCategory(TypeName)]
92  public virtual void Test_Analysis_POST_Identifier_Null()
93  {
94  POST_Attribute_Null(a => a.identifier);
95  }
96  [TestMethod, TestCategory(TypeName)]
98  {
99  POST_StringAttribute_Empty(a => a.identifier);
100  }
101  #endregion identifier
102 
103  #region source
104  [TestMethod, TestCategory(TypeName)]
105  public virtual void Test_Analysis_POST_Source_Null()
106  {
107  POST_Attribute_Null(a => a.source);
108  }
109  [TestMethod, TestCategory(TypeName)]
110  public virtual void Test_Analysis_POST_Source_Blank()
111  {
112  POST_StringAttribute_Empty(a => a.source);
113  }
114  #endregion source
115 
116  #region vendor
117  [TestMethod, TestCategory(TypeName)]
118  public virtual void Test_Analysis_POST_Vendor_Null()
119  {
120  POST_Attribute_Null(a => a.vendor);
121  }
122  [TestMethod, TestCategory(TypeName)]
123  public virtual void Test_Analysis_POST_Vendor_Blank()
124  {
125  POST_StringAttribute_Empty(a => a.vendor);
126  }
127  #endregion vendor
128  #endregion POST
129 
130  #region PUT
131  #region agent
132  [TestMethod, TestCategory(TypeName)]
133  public virtual void Test_Analysis_PUT_Agent()
134  {
135  PUT_WithValue(a => a.agent, Samples.Agent.AsReference, true);
136  }
137  [TestMethod, TestCategory(TypeName)]
138  public virtual void Test_Analysis_PUT_Agent_Null()
139  {
140  PUT_Attribute_Null(a => a.agent);
141  }
142  [TestMethod, TestCategory(TypeName)]
144  {
145  PUT_Reference_NullId(a => a.agent);
146  }
147  [TestMethod, TestCategory(TypeName)]
149  {
150  PUT_Reference_EmptyStringId(a => a.agent);
151  }
152  [TestMethod, TestCategory(TypeName)]
154  {
155  PUT_Reference_NonExistantId(a => a.agent);
156  }
157  #endregion agent
158 
159  #region host
160  [TestMethod, TestCategory(TypeName)]
161  public virtual void Test_Analysis_PUT_Host()
162  {
163  PUT_WithValue(a => a.host, "Modified Host", true);
164  }
165  [TestMethod, TestCategory(TypeName)]
166  public virtual void Test_Analysis_PUT_Host_Null()
167  {
168  PUT_Attribute_Null(a => a.host);
169  }
170  [TestMethod, TestCategory(TypeName)]
171  public virtual void Test_Analysis_PUT_Host_Blank()
172  {
173  PUT_StringAttribute_Empty(a => a.host);
174  }
175  #endregion host
176 
177  #region identifier
178  [TestMethod, TestCategory(TypeName)]
179  public virtual void Test_Analysis_PUT_Identifier()
180  {
181  PUT_WithValue(a => a.identifier, "Modified Identifier", true);
182  }
183  [TestMethod, TestCategory(TypeName)]
184  public virtual void Test_Analysis_PUT_Identifier_Null()
185  {
186  PUT_Attribute_Null(a => a.identifier);
187  }
188  [TestMethod, TestCategory(TypeName)]
190  {
191  PUT_StringAttribute_Empty(a => a.identifier);
192  }
193  #endregion identifier
194 
195  #region source
196  [TestMethod, TestCategory(TypeName)]
197  public virtual void Test_Analysis_PUT_Source()
198  {
199  PUT_WithValue(a => a.source, "Modified Source", true);
200  }
201  [TestMethod, TestCategory(TypeName)]
202  public virtual void Test_Analysis_PUT_Source_Null()
203  {
204  PUT_Attribute_Null(a => a.source);
205  }
206  [TestMethod, TestCategory(TypeName)]
207  public virtual void Test_Analysis_PUT_Source_Blank()
208  {
209  PUT_StringAttribute_Empty(a => a.source);
210  }
211  #endregion source
212 
213  #region vendor
214  [TestMethod, TestCategory(TypeName)]
215  public virtual void Test_Analysis_PUT_Vendor()
216  {
217  PUT_WithValue(a => a.vendor, "Modified Vendor", true);
218  }
219  [TestMethod, TestCategory(TypeName)]
220  public virtual void Test_Analysis_PUT_Vendor_Null()
221  {
222  PUT_Attribute_Null(a => a.vendor);
223  }
224  [TestMethod, TestCategory(TypeName)]
225  public virtual void Test_Analysis_PUT_Vendor_Blank()
226  {
227  PUT_StringAttribute_Empty(a => a.vendor);
228  }
229  #endregion vendor
230  #endregion PUT
231  }
232 }
Exposes sample resource objects, with built-in methods for injecting dependencies.
Definition: Samples.cs:13
static readonly ResourceCollection< Analysis > Analyses
The collection of Analyses on the server.
API methods / requests made available to the user.
IReference< T > AsReference
A reference to the posted resource.
IInjectableResource< VendorPortfolioAnalysis > Analysis_VendorPortfolioAnalysis
IInjectableResource< VendorTreatyAnalysis > Analysis_VendorTreatyAnalysis
Includes tests that affect all types of Analyses
IInjectableResource< Agent > Agent
Represents the metadata for a DataAgent analysis entity imported from a vendor.
Definition: Analysis.cs:12
Tests for a stored resource collection which do not require an instance of that resource to be define...