Esempio n. 1
0
        public void GetById_db1NotNull_ShouldPassA()
        {
            XpoDataStoreResolver DataStoreResolver =
                new XpoDataStoreResolver(ConfiguratioName);


            XpoInitializerResolver xpoInitializerResolver = new XpoInitializerResolver(DataStoreResolver, typeof(Invoice), typeof(Customer));

            IXpoInitializer FirstInitializer = xpoInitializerResolver.GetById("db1");

            var FirstUoW = FirstInitializer.CreateUnitOfWork();



            Customer FirstPerson = new Customer(FirstUoW);

            FirstPerson.Name = "Jose Manuel Ojeda Melgar";
            if (FirstUoW.InTransaction)
            {
                FirstUoW.CommitChanges();
            }


            IXpoInitializer SecondInitializer = xpoInitializerResolver.GetById("db1");
            var             SecondUoW         = SecondInitializer.CreateUnitOfWork();

            var SecondPerson = SecondUoW.FindObject <Customer>(new BinaryOperator(nameof(Customer.Name), FirstPerson.Name));



            Assert.AreEqual(FirstPerson.Name, SecondPerson.Name);
        }
Esempio n. 2
0
        public void GetById_ArgumentException_ShouldFail()
        {
            XpoDataStoreResolver DataStoreResolver =
                new XpoDataStoreResolver(ConfiguratioName);


            XpoInitializerResolver xpoInitializerResolver = new XpoInitializerResolver(DataStoreResolver, typeof(Invoice), typeof(Customer));

            IXpoInitializer xpoinitializer = xpoInitializerResolver.GetById("db1");


            Assert.Throws <ArgumentException>(() =>
                                              xpoInitializerResolver.GetById("db99")
                                              );
        }
Esempio n. 3
0
        public void ResolveRuntime_ShouldPass()
        {
            XpoDataStoreResolver DataStoreResolver =
                new XpoDataStoreResolver(ConfiguratioName);


            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile(ConfiguratioName);

            builder.Build();


            var NewConfig = File.ReadAllText("NewConnectionString.json");

            File.WriteAllText(ConfiguratioName, NewConfig);



            XpoInitializerResolver xpoInitializerResolver = new XpoInitializerResolver(DataStoreResolver, typeof(Invoice), typeof(Customer));

            var db99 = xpoInitializerResolver.GetById("db99");


            Assert.IsNotNull(db99);
        }
Esempio n. 4
0
        public void GetById_db1NotNull_ShouldPass()
        {
            XpoDataStoreResolver DataStoreResolver =
                new XpoDataStoreResolver(ConfiguratioName);


            XpoInitializerResolver xpoInitializerResolver = new XpoInitializerResolver(DataStoreResolver, typeof(Invoice), typeof(Customer));

            IXpoInitializer xpoinitializer = xpoInitializerResolver.GetById("db1");


            Assert.IsNotNull(xpoinitializer);
        }