CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
DataPortalOperationQualificationTests.cs
Go to the documentation of this file.
2using Microsoft.VisualStudio.TestTools.UnitTesting;
3
5{
6 [TestClass]
8 {
9 [TestMethod]
10 public void Create()
11 {
12 var qualification = new DataPortalOperationQualification();
13 Assert.IsFalse(qualification.ByAttribute, nameof(qualification.ByAttribute));
14 Assert.IsFalse(qualification.ByNamingConvention, nameof(qualification.ByNamingConvention));
15 }
16
17 [TestMethod]
19 {
20 var qualification = new DataPortalOperationQualification(false, true);
21 Assert.IsTrue(qualification.ByAttribute, nameof(qualification.ByAttribute));
22 Assert.IsFalse(qualification.ByNamingConvention, nameof(qualification.ByNamingConvention));
23 }
24
25 [TestMethod]
27 {
28 var qualification = new DataPortalOperationQualification(true, false);
29 Assert.IsFalse(qualification.ByAttribute, nameof(qualification.ByAttribute));
30 Assert.IsTrue(qualification.ByNamingConvention, nameof(qualification.ByNamingConvention));
31 }
32
33 [TestMethod]
35 Assert.IsFalse(new DataPortalOperationQualification());
36
37 [TestMethod]
39 Assert.IsTrue(new DataPortalOperationQualification(false, true));
40
41 [TestMethod]
43 Assert.IsTrue(new DataPortalOperationQualification(true, false));
44
45 [TestMethod]
47 {
48 var qualification = new DataPortalOperationQualification(false, false).Combine(
49 new DataPortalOperationQualification(false, false));
50 Assert.IsFalse(qualification.ByNamingConvention, nameof(qualification.ByNamingConvention));
51 Assert.IsFalse(qualification.ByAttribute, nameof(qualification.ByAttribute));
52 }
53
54 [TestMethod]
56 {
57 var (byNamingConvention, byAttribute) = new DataPortalOperationQualification(false, false);
58 Assert.IsFalse(byNamingConvention, nameof(byNamingConvention));
59 Assert.IsFalse(byAttribute, nameof(byAttribute));
60 }
61
62 [TestMethod]
64 {
65 var (byNamingConvention, byAttribute) = new DataPortalOperationQualification(false, true);
66 Assert.IsFalse(byNamingConvention, nameof(byNamingConvention));
67 Assert.IsTrue(byAttribute, nameof(byAttribute));
68 }
69
70 [TestMethod]
72 {
73 var (byNamingConvention, byAttribute) = new DataPortalOperationQualification(true, false);
74 Assert.IsTrue(byNamingConvention, nameof(byNamingConvention));
75 Assert.IsFalse(byAttribute, nameof(byAttribute));
76 }
77
78 [TestMethod]
80 {
81 var (byNamingConvention, byAttribute) = new DataPortalOperationQualification(true, true);
82 Assert.IsTrue(byNamingConvention, nameof(byNamingConvention));
83 Assert.IsTrue(byAttribute, nameof(byAttribute));
84 }
85
86 [DataRow(false, false, false, false, false, false)]
87 [DataRow(false, false, false, true, false, true)]
88 [DataRow(false, false, true, false, true, false)]
89 [DataRow(false, false, true, true, true, true)]
90 [DataRow(false, true, false, false, false, true)]
91 [DataRow(false, true, false, true, false, true)]
92 [DataRow(false, true, true, false, true, true)]
93 [DataRow(false, true, true, true, true, true)]
94 [DataRow(true, false, false, false, true, false)]
95 [DataRow(true, false, false, true, true, true)]
96 [DataRow(true, false, true, false, true, false)]
97 [DataRow(true, false, true, true, true, true)]
98 [DataRow(true, true, false, false, true, true)]
99 [DataRow(true, true, false, true, true, true)]
100 [DataRow(true, true, true, false, true, true)]
101 [DataRow(true, true, true, true, true, true)]
102 [DataTestMethod]
103 public void Combine(bool firstByNamingConvention, bool firstByAttribute, bool secondByNamingConvention, bool secondByAttribute,
104 bool expectedByNamingConvention, bool expectedByAttribute)
105 {
106 var qualification = new DataPortalOperationQualification(firstByNamingConvention, firstByAttribute).Combine(
107 new DataPortalOperationQualification(secondByNamingConvention, secondByAttribute));
108 Assert.AreEqual(expectedByNamingConvention, qualification.ByNamingConvention, nameof(qualification.ByNamingConvention));
109 Assert.AreEqual(expectedByAttribute, qualification.ByAttribute, nameof(qualification.ByAttribute));
110 }
111 }
112}
void Combine(bool firstByNamingConvention, bool firstByAttribute, bool secondByNamingConvention, bool secondByAttribute, bool expectedByNamingConvention, bool expectedByAttribute)
DataPortalOperationQualification Combine(DataPortalOperationQualification qualification)