123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using Luticate2.Utils.Dbo.Result;
- using Luticate2.Utils.Utils;
- using Microsoft.Extensions.DependencyInjection;
- using TestUtils.DataAccess;
- using TestUtils.Dbo.PkGuid;
- using Xunit;
-
- namespace TestUtils.EfCrudDataAccess
- {
- public class LuEfTransactionScopeTest
- {
- [Fact]
- public void TestAddDboSingle1()
- {
- var serviceProvider = Tests.BuildRealDbServiceProvider();
- var service = serviceProvider.GetService<LuUtilsPkGuidDataAccess>();
- var transact = service.BeginTransaction(null);
- var res = service.AddDbo(new PkGuidAddDbo
- {
- SomeInt = 42,
- SomeText = "Test."
- });
- Assert.Equal(LuStatus.Success, res.Status);
- Assert.NotEqual(new Guid().ToString(), res.Data.Id);
-
- var get = service.GetSingleById(res.Data.Id);
- Assert.Equal(LuStatus.Success, get.Status);
-
- service.RollbackTransaction(transact);
-
- get = service.GetSingleById(res.Data.Id);
- Assert.Equal(LuStatus.NotFound, get.Status);
- }
- }
- }
|