C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
Test_Portfolio.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Linq;
3
4using AnalyzeRe;
7
8#if MSTEST
9using Microsoft.VisualStudio.TestTools.UnitTesting;
10#elif NUNIT
11using TestClass = NUnit.Framework.TestFixtureAttribute;
12using TestMethod = NUnit.Framework.TestAttribute;
13using TestCategory = NUnit.Framework.CategoryAttribute;
14#endif
15
17{
18 [TestClass]
23
24 [TestClass]
25 public sealed class TestSuite_Portfolio_StaticPortfolio : TestSuite_Portfolio<StaticPortfolio>
26 {
27 #region Set Up and Configuration
28 private const string TypeName = "StaticPortfolio";
31
32 #endregion Set Up and Configuration
33
34 #region POST
35 #region layers
36 [TestMethod, TestCategory(TypeName)]
38 {
39 POST_Attribute_Null(p => p.layers);
40 }
41 [TestMethod, TestCategory(TypeName)]
43 {
44 POST_WithValue(p => p.layers, new HashSet<IReference<ILayer>>(), false);
45 }
46 [TestMethod, TestCategory(TypeName)]
52 // TODO: Test duplicates not allowed.
53 #endregion layers
54 #endregion POST
55
56 #region PUT
57 #region layers
58 [TestMethod, TestCategory(TypeName)]
60 {
61 PUT_WithValue(p => p.layers, new HashSet<IReference<ILayer>>(
62 Samples.AllSaveableLayerTypesTestList.Select(l => l.AsReference)), true);
63 }
64 [TestMethod, TestCategory(TypeName)]
66 {
67 PUT_Attribute_Null(p => p.layers);
68 }
69 [TestMethod, TestCategory(TypeName)]
71 {
72 PUT_WithValue(p => p.layers, new HashSet<IReference<ILayer>>(), false);
73 }
74 [TestMethod, TestCategory(TypeName)]
83 #endregion layers
84 #endregion PUT
85 }
86
87 #region Abstract Base Test Class
88 [TestClass]
90 {
91 private const string TypeName = "Portfolio";
92
93 #region POST
94 #region name
95 [TestMethod, TestCategory(TypeName)]
96 public virtual void Test_Portfolio_POST_Name_Null()
97 {
98 POST_Attribute_Null(p => p.name);
99 }
100 [TestMethod, TestCategory(TypeName)]
101 public virtual void Test_Portfolio_POST_Name_Blank()
102 {
103 POST_StringAttribute_Empty(p => p.name);
104 }
105 #endregion name
106 #endregion POST
107
108 #region PUT
109 #region name
110 [TestMethod, TestCategory(TypeName)]
111 public virtual void Test_Portfolio_PUT_Name()
112 {
113 PUT_WithValue(p => p.name, "Modified Name", true);
114 }
115 [TestMethod, TestCategory(TypeName)]
116 public virtual void Test_Portfolio_PUT_Name_Null()
117 {
118 PUT_Attribute_Null(p => p.name);
119 }
120 [TestMethod, TestCategory(TypeName)]
121 public virtual void Test_Portfolio_PUT_Name_Blank()
122 {
123 PUT_StringAttribute_Empty(p => p.name);
124 }
125 #endregion name
126 #endregion PUT
127 }
128 #endregion Abstract Base Test Class
129}
Tests for a stored resource collection which do not require an instance of that resource to be define...
void PUT_StringAttribute_Empty(Expression< Func< T, string > > PropertyExpression, bool? shouldSucceed=null)
Ensure that when doing a PUT with the specified attribute set to an empty string, the PUT succeeds or...
void POST_StringAttribute_Empty(Expression< Func< T, string > > PropertyExpression, bool? shouldSucceed=null)
Post a resource with the specified string set to an empty string.
Exposes sample resource objects, with built-in methods for injecting dependencies.
Definition Samples.cs:14
List< IInjectableResource< ILayer > > AllSaveableLayerTypesTestList
A list of one of each type of layer that can be POSTed. Layer types that cannot be posted on their ow...
IInjectableResource< StaticPortfolio > Portfolio
static string Valid_NonExistant_UUID
Definition Samples.cs:41
override IResourceCollection< Portfolio > collection_source
override IInjectableResource< StaticPortfolio > TestInjectableResource
Describes a collection of resources which can be listed.
API methods / requests made available to the user.
static readonly ResourceCollection< Portfolio > Portfolios
The collection of Portfolios on the server.
Representation of a portfolio.
Definition Portfolio.cs:12