コード例 #1
0
        public void TestGetCarEntityEntryValidEntity()
        {
            // Arrange
            EntityEntry <RepairJob> result;

            using (var context = new ApplicationDbContext(DbContextOptions))
            {
                context.Database.EnsureCreated();

//                SeedRepairJobData(context);

                var repository = new RepairJobRepository(context);

                var testEntity =
                    context.RepairJob.FirstOrDefault(
                        rj => rj.Id == 1);

                // Act
                result = repository.GetRepairJobEntityEntry(testEntity);

                context.Database.EnsureDeleted();
            }

            // Assert
            Assert.NotNull(result);
            Assert.IsType <EntityEntry <RepairJob> >(result);
        }
コード例 #2
0
        public void TestGetListingEntityEntryNull()
        {
            // Arrange
            EntityEntry <RepairJob> result;

            using (var context = new ApplicationDbContext(DbContextOptions))
            {
                context.Database.EnsureCreated();

                var repository = new RepairJobRepository(context);

                // Act
                result = repository.GetRepairJobEntityEntry(null);

                context.Database.EnsureDeleted();
            }

            // Assert
            Assert.Null(result);
        }