Browse Source

[WebApiUtils] tests

feature/authentication-tests
Robin Thoni 9 years ago
parent
commit
cdf9cd113a

+ 5
- 0
WebAPiUtils-test/BusinessManager/ValuesBusiness.cs View File

@@ -26,5 +26,10 @@ namespace WebAPiUtils_test.BusinessManager
26 26
         {
27 27
             return ValuesManager.AddId(obj);
28 28
         }
29
+
30
+        public static OpResult<ValuesDboGet> AddDbo(ValuesDboAdd obj)
31
+        {
32
+            return ValuesManager.AddDbo(obj);
33
+        }
29 34
     }
30 35
 }

+ 8
- 1
WebAPiUtils-test/Controllers/ValuesController.cs View File

@@ -32,9 +32,16 @@ namespace WebAPiUtils_test.Controllers
32 32
 
33 33
         [HttpPost]
34 34
         [Route("api/values/add")]
35
-        public long Edit(ValuesDboAdd obj)
35
+        public long Add(ValuesDboAdd obj)
36 36
         {
37 37
             return BMRHandler<long>.Handle(ValuesBusiness.Add(obj), Request);
38 38
         }
39
+
40
+        [HttpPost]
41
+        [Route("api/values/adddbo")]
42
+        public ValuesDboGet AddDbo(ValuesDboAdd obj)
43
+        {
44
+            return BMRHandler<ValuesDboGet>.Handle(ValuesBusiness.AddDbo(obj), Request);
45
+        }
39 46
     }
40 47
 }

+ 9
- 11
WebAPiUtils-test/DataAccess/ValuesManager.cs View File

@@ -25,28 +25,26 @@ namespace WebAPiUtils_test.DataAccess
25 25
             };
26 26
         }
27 27
 
28
-        public override OpResult<T_SqlManager> DboAddToDb(ValuesDboAdd obj)
28
+        public override OpResult<bool> DboAddToDb(ValuesDboAdd obj, T_SqlManager add)
29 29
         {
30 30
             var res = GetSingleById(obj.TextId);
31 31
             if (!res)
32
-                return res.To<T_SqlManager>();
33
-            return OpResult<T_SqlManager>.Ok(new T_SqlManager
34
-            {
35
-                my_string = obj.MyString,
36
-                my_int = obj.MyInt,
37
-                text = obj.TextId
38
-            });
32
+                return res.To<bool>();
33
+            add.my_string = obj.MyString;
34
+            add.my_int = obj.MyInt;
35
+            add.text = obj.TextId;
36
+            return OpResult<bool>.Ok(true);
39 37
         }
40 38
 
41
-        public override OpResult<T_SqlManager> DboEditToDb(ValuesDboEdit obj, T_SqlManager edit)
39
+        public override OpResult<bool> DboEditToDb(ValuesDboEdit obj, T_SqlManager edit)
42 40
         {
43 41
             var res = GetSingleById(obj.TextId);
44 42
             if (!res)
45
-                return res.To<T_SqlManager>();
43
+                return res.To<bool>();
46 44
             edit.my_string = obj.MyString;
47 45
             edit.my_int = obj.MyInt;
48 46
             edit.text = obj.TextId;
49
-            return OpResult<T_SqlManager>.Ok(edit);
47
+            return OpResult<bool>.Ok(true);
50 48
         }
51 49
 
52 50
         public static OpResult<DboGetMultiple<ValuesDboGet>> Contains(string text, int page, int perPage)

Loading…
Cancel
Save