예제 #1
0
        public void Delete_InputExistinfoId_Removed()
        {
            int          expectedListCount = 0;
            var          context           = SqlLiteInMemoryContext();
            EFUnitOfWork uow = new EFUnitOfWork(context);

            Catalog.DAL.Repositories.Interfaces.infoRepository repository = uow.infos;
            info info = new info()
            {
                CatalogID   = 3,
                Name        = "testN",
                Description = "testD",
                Catalog     = new Catalog.DAL.Entities.Catalog()
                {
                    CatalogID = 3
                }
            };

            context.infos.Add(info);
            context.SaveChanges();


            repository.Delete(info.infoID);
            uow.Save();
            var factinfoCount = context.infos.Count();


            Assert.Equal(expectedListCount, factinfoCount);
        }
예제 #2
0
        public void Get_InputExistinfoId_Returninfo()
        {
            var          context = SqlLiteInMemoryContext();
            EFUnitOfWork uow     = new EFUnitOfWork(context);

            Catalog.DAL.Repositories.Interfaces.infoRepository repository = uow.infos;
            info expectedinfo = new info()
            {
                CatalogID   = 3,
                Name        = "testN",
                Description = "testD",
                Catalog     = new Catalog.DAL.Entities.Catalog()
                {
                    CatalogID = 3
                }
            };

            context.infos.Add(expectedinfo);
            context.SaveChanges();


            var factinfo = repository.Get(expectedinfo.infoID);


            Assert.Equal(expectedinfo, factinfo);
        }
예제 #3
0
        public void Create_InputinfoWithId0_SetinfoId1()
        {
            // Arrange
            int          expectedListCount = 3;
            var          context           = SqlLiteInMemoryContext();
            EFUnitOfWork uow = new EFUnitOfWork(context);

            Catalog.DAL.Repositories.Interfaces.infoRepository repository = uow.infos;

            info info = new info()
            {
                CatalogID   = 3,
                Name        = "testN",
                Description = "testD",
                Catalog     = new Catalog.DAL.Entities.Catalog()
                {
                    CatalogID = 3
                }
            };


            repository.Create(info);
            uow.Save();
            var factListCount = context.infos.Count();


            Assert.Equal(expectedListCount, factListCount);
        }