Ejemplo n.º 1
0
        public void OptinallyCreateWithData()
        {
            var data    = new DataDummy();
            var message = new Message("Irrelevant", data);

            Assert.IsTrue(message.HasData);
            Assert.AreSame(data, message.GetData <DataDummy>());
        }
Ejemplo n.º 2
0
        public async Task AddMany(List <Tabla> entityList)
        {
            var data  = new DataDummy();
            var table = data.DummyTable(entityList);

            using (var connection = Connection)
            {
                //connection.Open();
                await connection.ExecuteAsync("usp_InsertTvp", new { Records = table.AsTableValuedParameter("TvpRecords") }, commandType : CommandType.StoredProcedure);
            }
        }
Ejemplo n.º 3
0
        public App()
        {
            InitializeComponent();
            Register();
            var data = new DataDummy();

            data.GenerateDataDummy();
            var application = App.Container.Resolve <IApplicationService>();

            application.Start();
        }
Ejemplo n.º 4
0
        public void BroadcastWithDataPassesOnDataObject()
        {
            var listener = new ListenerSpy();

            receiver.SubscribeToMessage("AMessage", listener.Method);
            var data = new DataDummy();

            dispatcher.BroadcastWithData("AMessage", data);

            Assert.AreSame(data, listener.ReceivedData);
        }
Ejemplo n.º 5
0
        public void GetDataFieldsNamesTest()
        {
            var d     = new DataDummy();
            var names = d.GetDataFieldsNames();

            Assert.AreEqual(trueNames.Length, names.Count);
            foreach (var tn in trueNames)
            {
                Assert.IsTrue(names.Contains(tn));
            }
        }
Ejemplo n.º 6
0
        public async Task AddMany(List <Tabla> entityList)
        {
            var data  = new DataDummy();
            var table = data.DummyTable(entityList);

            var param = new SqlParameter("@Records", table)
            {
                TypeName  = "TvpRecords",
                SqlDbType = SqlDbType.Structured
            };

            await _context.Database.ExecuteSqlRawAsync("exec usp_InsertTvp @Records", param);
        }
Ejemplo n.º 7
0
        public void GetValuesTest()
        {
            var tst = Enumerable.Range(0, 100)
                      .Select(i => new DataDummy()
            {
                Index       = 1,
                X           = 2,
                V           = 3,
                IndexInList = -1,
                P           = 1 * i,
                Ro          = 200,
                p           = 300
            });

            var Ps = DataDummy.GetValues <double>(tst, "P").ToList();

            foreach (var i in Enumerable.Range(0, 100).Select(ii => (double)ii))
            {
                Assert.IsTrue(Ps.Contains(i));
            }
        }
Ejemplo n.º 8
0
        public void ThisTest()
        {
            var tst = new DataDummy()
            {
                Index       = 1,
                X           = 2,
                V           = 3,
                IndexInList = -1,
                P           = 100,
                Ro          = 200,
                p           = 300
            };

            Assert.AreEqual(1, tst["Index"]);
            Assert.AreEqual(-1, tst["IndexInList"]);
            Assert.AreEqual(2d, tst["X"]);
            Assert.AreEqual(3d, tst["V"]);
            Assert.AreEqual(100d, tst["P"]);
            Assert.AreEqual(200d, tst["Ro"]);
            Assert.AreEqual(300d, tst["p"]);
            Assert.IsNull(tst["p "]);
        }