コード例 #1
0
        public void Seed(TestSendSMSHostContext db)
        {
            db.Status.AddOrUpdate(new Status {
                Id = 1, Name = "Created", DefaultColorHex = "#fdfdfe"
            });
            db.Status.AddOrUpdate(new Status {
                Id = 2, Name = "Queued", DefaultColorHex = "#bee5eb"
            });
            db.Status.AddOrUpdate(new Status {
                Id = 3, Name = "Pending", DefaultColorHex = "#ffeeba"
            });
            db.Status.AddOrUpdate(new Status {
                Id = 4, Name = "Sent", DefaultColorHex = "#c3e6cb"
            });
            db.Status.AddOrUpdate(new Status {
                Id = 0, Name = "Error", DefaultColorHex = "#f5c6cb"
            });

            Contact freddy = new Contact
            {
                Id        = new Guid("6185B42F-7A64-4D9B-9098-B5E4503E75C7"),
                FirstName = "Freddy",
                LastName  = "De Testaccount",
                Number    = "+32494240152"
            };

            db.Contacts.AddOrUpdate(freddy);

            db.SaveChanges();
        }
コード例 #2
0
        public void Initialize()
        {
            var connection = DbConnectionFactory.CreateTransient();

            db = new TestSendSMSHostContext(connection);

            var init = new TestDataInitialiser();

            init.Seed(db);

            #region Add Logs

            db.Log.Add(
                new Log
            {
                SmsId      = "1",
                StatusName = "Queued",
                Timestamp  = DateTime.Now
            });
            db.Log.Add(
                new Log
            {
                SmsId      = "2",
                StatusName = "Error",
                Timestamp  = DateTime.Now.AddMinutes(-15)
            });
            db.Log.Add(
                new Log
            {
                SmsId      = "3",
                StatusName = "Created",
                Timestamp  = DateTime.Now.AddMinutes(-25)
            });
            db.Log.Add(
                new Log
            {
                SmsId      = "4",
                StatusName = "Created",
                Timestamp  = DateTime.Now.AddMinutes(-30)
            });
            db.Log.Add(
                new Log
            {
                SmsId      = "1",
                StatusName = "Created",
                Timestamp  = DateTime.Now.AddMinutes(-30)
            });
            db.Log.Add(
                new Log
            {
                SmsId      = "2",
                StatusName = "Created",
                Timestamp  = DateTime.Now.AddMinutes(-30)
            });

            #endregion

            db.SaveChanges();
        }
コード例 #3
0
        public void Initialize()
        {
            var connection = DbConnectionFactory.CreateTransient();

            db = new TestSendSMSHostContext(connection);

            var init = new TestDataInitialiser();

            init.Seed(db);

            #region Add Sms

            db.Sms.Add(
                new Sms
            {
                Id        = Guid.NewGuid(),
                ContactId = Guid.Parse(FREDDY_ID),
                Message   = "Test",
                StatusId  = 1,
                TimeStamp = DateTime.Now
            });
            db.Sms.Add(
                new Sms
            {
                Id        = Guid.NewGuid(),
                ContactId = Guid.Parse(FREDDY_ID),
                Message   = "Test",
                StatusId  = 2,
                TimeStamp = DateTime.Now.AddMinutes(-1)
            });
            db.Sms.Add(
                new Sms
            {
                Id        = Guid.NewGuid(),
                ContactId = Guid.Parse(FREDDY_ID),
                Message   = "Test",
                StatusId  = 3,
                TimeStamp = DateTime.Now.AddMinutes(-2)
            });
            db.Sms.Add(
                new Sms
            {
                Id        = Guid.NewGuid(),
                ContactId = Guid.Parse(FREDDY_ID),
                Message   = "Test",
                StatusId  = 4,
                TimeStamp = DateTime.Now.AddMinutes(-3)
            });
            db.Sms.Add(
                new Sms
            {
                Id        = Guid.NewGuid(),
                ContactId = Guid.Parse(FREDDY_ID),
                Message   = "Test",
                StatusId  = 0,
                TimeStamp = DateTime.Now.AddMinutes(-3)
            });
            db.Sms.Add(
                new Sms
            {
                Id        = Guid.NewGuid(),
                ContactId = Guid.Parse(FREDDY_ID),
                Message   = "Test",
                StatusId  = 0,
                TimeStamp = DateTime.Now.AddMinutes(-3)
            });

            #endregion

            db.SaveChanges();
        }