Ejemplo n.º 1
0
        protected void DeleteText(object sender, EventArgs e)
        {
            ScreenShotActions deleteData = new ScreenShotActions();
            TextTrigger textTrigger = new TextTrigger();

            deleteData.deleteTextTrigger(textTrigger.id);
        }
 public void getAllToneTriggersTest()
 {
     ScreenShotActions target = new ScreenShotActions(true); // TODO: Initialize to an appropriate value
     List<ToneTrigger> actual;
     actual = target.getAllToneTriggers();
     Assert.IsNotNull(actual);
 }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ScreenShotActions data = new ScreenShotActions();
         RefreshTriggers(data);
     }
 }
Ejemplo n.º 4
0
        private void RefreshTriggers(ScreenShotActions data)
        {
            UserDropDownList.DataSource = data.getUsers();
            UserDropDownList.DataBind();

            colorRepeater.DataSource = data.getAllToneTriggers();
            colorRepeater.DataBind();
        }
 public void getScreenShotsByDateRangeTest()
 {
     ScreenShotActions target = new ScreenShotActions(true);
     DateTime fromDate = DateTime.Now.AddMonths(-1);
     DateTime toDate = DateTime.Now;
     List<ScreenShot> actual = new List<ScreenShot>();
     //actual = target.getScreenShotsByDateRange(fromDate, toDate); TODO: fix after we get the database working again
     //Assert.AreNotEqual(0, actual.Count);
 }
Ejemplo n.º 6
0
 protected void UpdateText(object sender, EventArgs e)
 {
     ScreenShotActions updateData = new ScreenShotActions();
         TextTrigger textTrigger = new TextTrigger()
         {
             triggerString = TriggerTB.Text,
             userName = UserDropDownList.Text
         };
        updateData.updateTextTrigger(textTrigger);
 }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ScreenShotActions data = new ScreenShotActions();
                RefreshTriggers(data);

                UserDropDownList.DataSource = data.getUsers();
                UserDropDownList.DataBind();

            }
        }
Ejemplo n.º 8
0
        protected void SubmitNewText(object sender, EventArgs e)
        {
            //insert trigger
            ScreenShotActions data = new ScreenShotActions();
            TextTrigger textTrigger = new TextTrigger()
            {
                triggerString = TriggerTB.Text,
                userName = UserDropDownList.Text,
            };
            data.insertTextTrigger(textTrigger);

            //refresh the triggers to bring back down the new trigger
            RefreshTriggers(data);

            //clear text boxes for a new trigger to be entered
            Clear(TriggerTB);
        }
Ejemplo n.º 9
0
 protected void SelectDate(object sender, EventArgs e)
 {
     DateTime date;
     DateTime.TryParse(DateTextBox.Text, out date);
     ScreenShotActions data = new ScreenShotActions();
     List<ScreenShot> screenShots = data.getScreenShotsByDateRange(date, date.AddDays(1));
     if (screenShots.Count > 0)
     {
         ThumbNailRepeater.DataSource = screenShots.OrderBy(image => image.timeStamp);
         ThumbNailRepeater.DataBind();
         foreach (var screenShot in screenShots)
         {
             screenShot.image.Dispose();
             screenShot.thumbnail.Dispose();
         }
     }
     else
     {
         Meow();
     }
 }
Ejemplo n.º 10
0
        protected void SubmitNewTone(object sender, EventArgs e)
        {
            //insert trigger
            ScreenShotActions data = new ScreenShotActions();
            ToneTrigger toneTrigger = new ToneTrigger()
            {
                userName = UserDropDownList.Text,
                sensitivity = int.Parse(colorSensitivity.Text),
                lowerColorBound = ColorTranslator.FromHtml('#' + colorLBTB.Text),
                upperColorBound = ColorTranslator.FromHtml('#' + colorUBTB.Text)
            };
            data.insertToneTrigger(toneTrigger);

            //refresh the triggers to bring back down the new trigger
            RefreshTriggers(data);

            //clear text boxes for a new trigger to be entered
            Clear(colorSensitivity);
            Clear(colorLBTB);
            Clear(colorUBTB);
        }
 public void getUsersTest()
 {
     ScreenShotActions target = new ScreenShotActions(true);
     string expected = "TESTUSER";
     List<string> users;
     users = target.getUsers();
     if (users.Count() > 1)
     {
         Assert.IsTrue(users.Contains(expected));
     }
     else
     {
         Console.WriteLine("No users found in database - expected can't be checked for");
         Assert.IsNotNull(users);
     }
 }
 public void insertToneTriggerTest()
 {
     ScreenShotActions target = new ScreenShotActions(true);
     ToneTrigger toneTrigger = new ToneTrigger();
     toneTrigger.userName = "******";
     toneTrigger.userEmail = "TEST@";
     toneTrigger.lowerColorBound = Color.AliceBlue;
     toneTrigger.upperColorBound = Color.Azure;
     toneTrigger.sensitivity = 80;
     Guid actual = target.insertToneTrigger(toneTrigger);
     Assert.IsNotNull(actual);
 }
        public void textTriggerFullTest()
        {
            //insert
            ScreenShotActions target = new ScreenShotActions(true);
            TextTrigger textTrigger = new TextTrigger();
            textTrigger.userName = "******";
            textTrigger.userEmail = "TEST@";
            textTrigger.triggerString = "TEST";
            Guid id = target.insertTextTrigger(textTrigger);
            Assert.IsNotNull(id);

            //update
            string newVal = "BAYAD WERDS";
            var allTriggers = target.getAllTextTriggers();
            TextTrigger outTrigger = allTriggers.First(t => t.id.Equals(id));
            outTrigger.triggerString = newVal;
            target.updateTextTrigger(outTrigger);
            allTriggers = target.getAllTextTriggers();
            outTrigger = allTriggers.First(t => t.id.Equals(id));
            Assert.AreEqual(newVal, outTrigger.triggerString);

            //delete
            target.deleteTextTrigger(outTrigger.id);
            Assert.AreEqual(target.getAllTextTriggers().Count(t => t.id.Equals(id)), 0);
        }
Ejemplo n.º 14
0
 private void RefreshTriggers(ScreenShotActions data)
 {
     textRepeater.DataSource = data.getAllTextTriggers();
     textRepeater.DataBind();
 }
        public void toneTriggerFullTest()
        {
            //insert
            ScreenShotActions target = new ScreenShotActions(true);
            ToneTrigger toneTrigger = new ToneTrigger();
            toneTrigger.userName = "******";
            toneTrigger.userEmail = "TEST@";
            toneTrigger.lowerColorBound = Color.AliceBlue;
            toneTrigger.upperColorBound = Color.Azure;
            toneTrigger.sensitivity = 80;
            Guid id = target.insertToneTrigger(toneTrigger);
            Assert.IsNotNull(id);

            //update
            int newVal = 70;
            var allTriggers = target.getAllToneTriggers();
            ToneTrigger outTrigger = allTriggers.First(t => t.id.Equals(id));
            outTrigger.sensitivity = newVal;
            target.updateToneTrigger(outTrigger);
            allTriggers = target.getAllToneTriggers();
            outTrigger = allTriggers.First(t => t.id.Equals(id));
            Assert.AreEqual(newVal, outTrigger.sensitivity);

            //delete
            target.deleteToneTrigger(outTrigger.id);
            Assert.AreEqual(target.getAllToneTriggers().Count(t => t.id.Equals(id)), 0);
        }
 public void userFullTest()
 {
     string testUser = "******";
     string testEmail = "unit@test";
     string updatedEmail = "unit@testNewEmail";
     ScreenShotActions target = new ScreenShotActions();
     User insertedUser = new User();
     insertedUser.userName = testUser;
     insertedUser.email = testEmail;
     insertedUser.isAdmin = false;
     insertedUser.isMonitored = false;
     target.insertUser(insertedUser);
     // Test if the user is there
     User returnedUser = target.getUserByUserName(testUser);
     Assert.IsNotNull(returnedUser);
     Assert.AreEqual(returnedUser.userName, testUser);
     returnedUser.email = updatedEmail;
     target.updateUser(returnedUser);
     // Test if the update worked
     User updatedUser = target.getUserByUserName(testUser);
     Assert.IsNotNull(updatedUser);
     Assert.AreEqual(updatedUser.email, updatedEmail);
     target.deleteUser(testUser);
     User deletedUser = target.getUserByUserName(testUser);
     // Test that the user was deleted
     Assert.IsNull(deletedUser);
 }
 public void getTextTriggersByUserTest()
 {
     ScreenShotActions target = new ScreenShotActions(true); // TODO: Initialize to an appropriate value
     string user = "******"; // TODO: Initialize to an appropriate value
     List<TextTrigger> expected = null; // TODO: Initialize to an appropriate value
     List<TextTrigger> actual;
     actual = target.getTextTriggersByUser(user);
     Assert.IsNotNull(actual);
     //Assert.AreEqual(expected, actual);
 }
 public void insertTextTriggerTest()
 {
     ScreenShotActions target = new ScreenShotActions(true);
     TextTrigger textTrigger = new TextTrigger();
     textTrigger.userName = "******";
     textTrigger.userEmail = "TEST@";
     textTrigger.triggerString = "TEST";
     Guid actual = target.insertTextTrigger(textTrigger);
     Assert.IsNotNull(actual);
 }