1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using Luticate2.Utils.Dbo.Result;
- 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.BuildServiceProvider();
- 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);
- }
- }
- }
|