public void SetUp()
 {
     _fakeContext = DbContextTest.CreateDbContext <EmployeeContext>();
     _mapper      = A.Fake <IMapper>();
     _factory     = new MapperFactory(_mapper);
     _repository  = new EmployeeRepository(_fakeContext, _factory);
 }
        public void ConstructorWithArgumentsShouldSuccess()
        {
            // Arrange
            var dbContext = new DbContextTest();

            // Actual
            var validator = new AbstractValidatorTest(dbContext);

            // Assertions
            Assert.NotNull(validator);
            Assert.Equal(0, validator.GetValidations().Count);
            Assert.NotNull(validator.GetContext());
            Assert.Same(dbContext, validator.GetContext());
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("测试即将开始,请按任意键继续.");
            Console.ReadKey();
            DbContextTest test = new DbContextTest();

            test.Test();
            List <KeyValuePair <Type, string> > list = new List <KeyValuePair <Type, string> >();
            KeyValuePair <Type, string>         kv   = list.FirstOrDefault();

            if (kv.Key == null)
            {
            }
            Console.WriteLine("测试完成,请按任意键继续.");
            Console.ReadKey();
        }
 public UnitTestQueryable()
 {
     _dbContextTest = new DbContextTest(new DbContextOptionsBuilder <DbContextTest>().UseSqlServer(DbContextTest.ConnectionString).Options);
 }
Exemplo n.º 5
0
 public void SetUp()
 {
     _fakeContext = DbContextTest.CreateDbContext <EmployeeContext>();
     _mapper      = A.Fake <IMapper>();
     _repository  = new DepartmentRepository(_fakeContext, _mapper);
 }