C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
Test_OptimizationFunctions.cs
Go to the documentation of this file.
1using System;
2using AnalyzeRe;
7
8#if MSTEST
9using Microsoft.VisualStudio.TestTools.UnitTesting;
10#elif NUNIT
11using NUnit.Framework;
12using TestClass = NUnit.Framework.TestFixtureAttribute;
13using TestMethod = NUnit.Framework.TestAttribute;
14using TestCategory = NUnit.Framework.CategoryAttribute;
15#endif
16
18{
19 [TestClass]
21 {
23
24 protected override bool PUT_Allowed => false;
25 }
26
27 [TestClass]
29 {
31
32 protected override bool PUT_Allowed => false;
33 }
34
35 [TestClass]
41
42 [TestClass]
48
49 [TestClass]
51 where T : AnalyzeRe.Optimization.Function
52 {
53 private const string TypeName = "OptimizationFunction";
54
55 // Any tests requiring a POSTable test resource need to get one with a unique name.
56 protected override T TestResource =>
57 TestInjectableResource.Unposted.Change(r => r.name, $"Random Name {Guid.NewGuid()}");
58
61 public override void Test_Resource_POST_ExistingId()
62 {
63 base.Test_Resource_POST_ExistingId();
64 }
65
66 #region POST
67 #region name
68 [TestMethod, TestCategory(TypeName)]
70 {
71 POST_Attribute_Null(a => a.name);
72 }
73 [TestMethod, TestCategory(TypeName)]
75 {
77 }
78 #endregion name
79
80 #region src
81 [TestMethod, TestCategory(TypeName)]
83 {
84 POST_Attribute_Null(a => a.src);
85 }
86 [TestMethod, TestCategory(TypeName)]
88 {
90 }
91 #endregion src
92 #endregion POST
93
94 #region Disabled Tests
95 [TestMethod, TestCategory(TypeName), TestCategory("Skipped")]
97 {
98 Skip.Indefinitely("ARE-6068: Missing 'metadata' property");
99 base.Test_Resource_POST_MetaData_MixedTypes();
100 }
101 [TestMethod, TestCategory(TypeName), TestCategory("Skipped")]
103 {
104 Skip.Indefinitely("ARE-6068: Missing 'metadata' property");
105 base.Test_Resource_POST_MetaData_MixedTypes();
106 }
107 [TestMethod, TestCategory(TypeName), TestCategory("Skipped")]
108 public override void Test_Resource_Search()
109 {
110 Skip.Indefinitely("ARE-6068: Missing 'metadata' property");
111 base.Test_Resource_Search();
112 }
113 #endregion Disabled Tests
114 }
115}
Tests for a stored resource collection which do not require an instance of that resource to be define...
void POST_StringAttribute_Empty(Expression< Func< T, string > > PropertyExpression, bool? shouldSucceed=null)
Post a resource with the specified string set to an empty string.
IInjectableResource< T > TestInjectableResource
Deriving class must override the TestResourceFactory to return a disposable POSTable test resource th...
Exposes sample resource objects, with built-in methods for injecting dependencies.
Definition Samples.cs:14
IInjectableResource< ProjectionFunction > ProjectionFunction
Sample comes from ARE-2652.
IInjectableResource< MetricsFunction > MetricsFunction
override void Test_Resource_Search()
All resources should support searching in a few fundamental ways.
override IInjectableResource< MetricsFunction > TestInjectableResource
override IInjectableResource< ProjectionFunction > TestInjectableResource
Class used in unit tests to mark tests as skipped by using Assert.Inconclusive() method.
Definition SkipUntil.cs:14
static void Indefinitely(string ticket=null)
Skip the specified test.
Definition SkipUntil.cs:54
Describes a collection of resources which can be listed.
API methods / requests made available to the user.
static readonly ResourceCollection< ProjectionFunction > ProjectionFunctions
The collection of optimization projection functions on the server.
static readonly ResourceCollection< MetricsFunction > MetricsFunctions
The collection of optimization metrics functions on the server.
The base class for custom optimization functions.
T Unposted
The unPOSTed resource definition.