Exemplo n.º 1
0
        public void TestSetupSingleDtoAndEntitiesTestAssemblyEfCoreContextAndTestDbContextOk()
        {
            //SETUP
            var options1 = SqliteInMemory.CreateOptions <EfCoreContext>();

            using (var context = new EfCoreContext(options1))
            {
                context.RegisterEntityClasses();
            }
            var options2 = SqliteInMemory.CreateOptions <TestDbContext>();

            using (var context = new TestDbContext(options2))
            {
                context.RegisterEntityClasses();
            }

            //ATTEMPT
            var setupDtos = new SetupDtosAndMappings(new GenericServicesConfig());

            setupDtos.ScanAllAssemblies(new[] { GetType().Assembly }, true);

            //VERIFY
            setupDtos.IsValid.ShouldBeFalse();
            setupDtos.Errors.Count.ShouldEqual(3);
        }
Exemplo n.º 2
0
        public void TestSetupSingleDtoAndEntitiesInitializeOk()
        {
            //SETUP
            var options = SqliteInMemory.CreateOptions <EfCoreContext>();

            using (var context = new EfCoreContext(options))
            {
                context.RegisterEntityClasses();

                //ATTEMPT
                var setupDtos       = new SetupDtosAndMappings(new GenericServicesConfig());
                var wrappedMappings = setupDtos.ScanAllAssemblies(new[] { typeof(BookListDto).Assembly }, true);

                //VERIFY
                setupDtos.IsValid.ShouldBeTrue(setupDtos.GetAllErrors());
                wrappedMappings.ShouldNotBeNull();
            }
        }