Пример #1
0
        public RepositoryTests()
        {
            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString("N"));
            optionsBuilder.ConfigureWarnings(w => w.Ignore(InMemoryEventId.TransactionIgnoredWarning));


            _grmEventContext = new GrmEventContext(optionsBuilder);

            TestDataBuilder.Build(_grmEventContext);
        }
Пример #2
0
 public GrmEventRepository(GrmEventContext grmEventContext)
 {
     _grmEventContext = grmEventContext;
 }
Пример #3
0
        public static void Build(GrmEventContext grmEventContext)
        {
            grmEventContext.GrmEvent.Add(new Models.V1.GrmEvent
            {
                Id        = GrmEventId,
                EffDate   = new DateTime(2011, 01, 01),
                EventType = SystemTypeId
            });

            grmEventContext.GrmEvent.Add(new Models.V1.GrmEvent
            {
                Id        = GrmEventId + 1,
                EffDate   = new DateTime(2011, 01, 01),
                EventType = SystemTypeId
            });

            grmEventContext.GrmEvent.Add(new Models.V1.GrmEvent
            {
                Id        = GrmEventId + 2,
                EffDate   = new DateTime(2011, 01, 01),
                EventType = SystemTypeId
            });

            grmEventContext.SystemType.Add(new SystemType
            {
                Id             = SystemTypeId,
                begEffDate     = new DateTime(2011, 01, 01),
                effStatus      = "A",
                shortDescr     = "ACTIVE",
                descr          = "ACTIVE",
                displayOrder   = 0,
                sysTypeCatId   = 1,
                tranId         = 1000,
                editShortDescr = 1,
                editDescr      = 1,
                canDeleteRow   = 0,
                canSelectRow   = 1,
                InternalId     = 10055,
                depSysTypeId   = 0
            });

            grmEventContext.SystemType.Add(new SystemType
            {
                Id         = SystemTypeId,
                begEffDate = new DateTime(2011, 01, 02),
                effStatus  = "I",
                shortDescr = "INACTIVE",
                descr      = "INACTIVE"
            });

            grmEventContext.GrmEventInformation.Add(new GrmEventInformation
            {
                GrmEventId      = GrmEventId,
                Description     = "UnitTestGrmEventInfo",
                EffectiveDate   = new DateTime(2011, 01, 01),
                EventType       = "Transfer",
                EventDate       = new DateTime(2011, 02, 01),
                RevenueObjectId = 100
            });

            grmEventContext.GrmEvent.Add(new Models.V1.GrmEvent
            {
                Id        = GrmEventId + 3,
                TranId    = -1000,
                EventType = SystemTypeId,
                RevObjId  = RevObjId,
                EffDate   = new DateTime(2016, 1, 1)
            });

            grmEventContext.SaveChanges();
        }