|
@@ -357,5 +357,171 @@ namespace Test.Utils.EfCrubDataAccess
|
357
|
357
|
Assert.Equal(res.Data.Id, get.Data.Id);
|
358
|
358
|
});
|
359
|
359
|
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+ [Fact]
|
|
363
|
+ public void TestGetSingle1()
|
|
364
|
+ {
|
|
365
|
+ Tests.TestRealDb(context =>
|
|
366
|
+ {
|
|
367
|
+ var service = new LuUtilsPkBigSerialDataAccess(context);
|
|
368
|
+ var res = service.AddDbo(new PkBigSerialAddDbo
|
|
369
|
+ {
|
|
370
|
+ SomeInt = 42,
|
|
371
|
+ SomeText = "42"
|
|
372
|
+ });
|
|
373
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
374
|
+ Assert.NotEqual(0, res.Data.Id);
|
|
375
|
+
|
|
376
|
+ var get = service.GetSingle(bigserial => bigserial.some_int == 42);
|
|
377
|
+ Assert.Equal(LuStatus.Success, get.Status);
|
|
378
|
+ Assert.Equal("42", get.Data.SomeText);
|
|
379
|
+ Assert.Equal(42, get.Data.SomeInt);
|
|
380
|
+ Assert.Equal(res.Data.Id, get.Data.Id);
|
|
381
|
+ });
|
|
382
|
+ }
|
|
383
|
+
|
|
384
|
+ [Fact]
|
|
385
|
+ public void TestGetSingle2()
|
|
386
|
+ {
|
|
387
|
+ Tests.TestRealDb(context =>
|
|
388
|
+ {
|
|
389
|
+ var service = new LuUtilsPkBigSerialDataAccess(context);
|
|
390
|
+ var res = service.AddDbo(new PkBigSerialAddDbo
|
|
391
|
+ {
|
|
392
|
+ SomeInt = 42,
|
|
393
|
+ SomeText = "42"
|
|
394
|
+ });
|
|
395
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
396
|
+ Assert.NotEqual(0, res.Data.Id);
|
|
397
|
+
|
|
398
|
+ var get = service.GetSingle(bigserial => bigserial.some_int == 24);
|
|
399
|
+ Assert.Equal(LuStatus.NotFound, get.Status);
|
|
400
|
+ });
|
|
401
|
+ }
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+ [Fact]
|
|
405
|
+ public void TestGetSingleByKeys1()
|
|
406
|
+ {
|
|
407
|
+ Tests.TestRealDb(context =>
|
|
408
|
+ {
|
|
409
|
+ var service = new LuUtilsPkBigSerialDataAccess(context);
|
|
410
|
+ var res = service.AddDbo(new PkBigSerialAddDbo
|
|
411
|
+ {
|
|
412
|
+ SomeInt = 42,
|
|
413
|
+ SomeText = "42"
|
|
414
|
+ });
|
|
415
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
416
|
+ Assert.NotEqual(0, res.Data.Id);
|
|
417
|
+
|
|
418
|
+ var get = service.GetSingleByKeys(new KeyValuePair<string, object>("some_text", "42"));
|
|
419
|
+ Assert.Equal(LuStatus.Success, get.Status);
|
|
420
|
+ Assert.Equal("42", get.Data.SomeText);
|
|
421
|
+ Assert.Equal(42, get.Data.SomeInt);
|
|
422
|
+ Assert.Equal(res.Data.Id, get.Data.Id);
|
|
423
|
+ });
|
|
424
|
+ }
|
|
425
|
+
|
|
426
|
+ [Fact]
|
|
427
|
+ public void TestGetSingleByKeys2()
|
|
428
|
+ {
|
|
429
|
+ Tests.TestRealDb(context =>
|
|
430
|
+ {
|
|
431
|
+ var service = new LuUtilsPkBigSerialDataAccess(context);
|
|
432
|
+ var res = service.AddDbo(new PkBigSerialAddDbo
|
|
433
|
+ {
|
|
434
|
+ SomeInt = 42,
|
|
435
|
+ SomeText = "42"
|
|
436
|
+ });
|
|
437
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
438
|
+ Assert.NotEqual(0, res.Data.Id);
|
|
439
|
+
|
|
440
|
+ var get = service.GetSingleByKeys(new KeyValuePair<string, object>("some_text", "24"));
|
|
441
|
+ Assert.Equal(LuStatus.NotFound, get.Status);
|
|
442
|
+ });
|
|
443
|
+ }
|
|
444
|
+
|
|
445
|
+ [Fact]
|
|
446
|
+ public void TestGetSingleById1()
|
|
447
|
+ {
|
|
448
|
+ Tests.TestRealDb(context =>
|
|
449
|
+ {
|
|
450
|
+ var service = new LuUtilsPkBigSerialDataAccess(context);
|
|
451
|
+ var res = service.AddId(new PkBigSerialAddDbo
|
|
452
|
+ {
|
|
453
|
+ SomeInt = 42,
|
|
454
|
+ SomeText = "42"
|
|
455
|
+ });
|
|
456
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
457
|
+ Assert.NotEqual(0, res.Data);
|
|
458
|
+
|
|
459
|
+ var get = service.GetSingleById(res.Data);
|
|
460
|
+ Assert.Equal(LuStatus.Success, get.Status);
|
|
461
|
+ Assert.Equal("42", get.Data.SomeText);
|
|
462
|
+ Assert.Equal(42, get.Data.SomeInt);
|
|
463
|
+ Assert.Equal(res.Data, get.Data.Id);
|
|
464
|
+ });
|
|
465
|
+ }
|
|
466
|
+
|
|
467
|
+ [Fact]
|
|
468
|
+ public void TestGetSingleById2()
|
|
469
|
+ {
|
|
470
|
+ Tests.TestRealDb(context =>
|
|
471
|
+ {
|
|
472
|
+ var service = new LuUtilsPkBigSerialDataAccess(context);
|
|
473
|
+ var res = service.AddId(new PkBigSerialAddDbo
|
|
474
|
+ {
|
|
475
|
+ SomeInt = 42,
|
|
476
|
+ SomeText = "42"
|
|
477
|
+ });
|
|
478
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
479
|
+ Assert.NotEqual(0, res.Data);
|
|
480
|
+
|
|
481
|
+ var get = service.GetSingle(bigserial => bigserial.some_int == 24);
|
|
482
|
+ Assert.Equal(LuStatus.NotFound, get.Status);
|
|
483
|
+ });
|
|
484
|
+ }
|
|
485
|
+
|
|
486
|
+ [Fact]
|
|
487
|
+ public void TestGetSingleById3()
|
|
488
|
+ {
|
|
489
|
+ Tests.TestRealDb(context =>
|
|
490
|
+ {
|
|
491
|
+ var service = new LuUtilsPkGuidDataAccess(context);
|
|
492
|
+ var res = service.AddGuid(new PkGuidAddDbo
|
|
493
|
+ {
|
|
494
|
+ SomeInt = 42,
|
|
495
|
+ SomeText = "42"
|
|
496
|
+ });
|
|
497
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
498
|
+ Assert.NotEqual(new Guid().ToString(), res.Data);
|
|
499
|
+
|
|
500
|
+ var get = service.GetSingleById(res.Data);
|
|
501
|
+ Assert.Equal(LuStatus.Success, get.Status);
|
|
502
|
+ Assert.Equal("42", get.Data.SomeText);
|
|
503
|
+ Assert.Equal(42, get.Data.SomeInt);
|
|
504
|
+ Assert.Equal(res.Data, get.Data.Id);
|
|
505
|
+ });
|
|
506
|
+ }
|
|
507
|
+
|
|
508
|
+ [Fact]
|
|
509
|
+ public void TestGetSingleById4()
|
|
510
|
+ {
|
|
511
|
+ Tests.TestRealDb(context =>
|
|
512
|
+ {
|
|
513
|
+ var service = new LuUtilsPkGuidDataAccess(context);
|
|
514
|
+ var res = service.AddGuid(new PkGuidAddDbo
|
|
515
|
+ {
|
|
516
|
+ SomeInt = 42,
|
|
517
|
+ SomeText = "42"
|
|
518
|
+ });
|
|
519
|
+ Assert.Equal(LuStatus.Success, res.Status);
|
|
520
|
+ Assert.NotEqual(new Guid().ToString(), res.Data);
|
|
521
|
+
|
|
522
|
+ var get = service.GetSingle(bigserial => bigserial.some_int == 24);
|
|
523
|
+ Assert.Equal(LuStatus.NotFound, get.Status);
|
|
524
|
+ });
|
|
525
|
+ }
|
360
|
526
|
}
|
361
|
527
|
}
|