예제 #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>());
        }
예제 #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);
            }
        }
예제 #3
0
        public App()
        {
            InitializeComponent();
            Register();
            var data = new DataDummy();

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

            application.Start();
        }
예제 #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);
        }
예제 #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));
            }
        }
예제 #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);
        }
예제 #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));
            }
        }
예제 #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 "]);
        }