public void TestGetDecks()
 {
     Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1");
     List<Deck> decks = traitify.GetDecks();
     int mycount = decks.Count;
     Assert.AreNotEqual(mycount, 0);
 }
        public void TestCreateAssessment()
        {
            Traitify trait = new Traitify(_host, _publicKey, _secretKey, "v1");
            Deck deck = getDeck();

            var response = trait.CreateAssesment(deck.id);
            Assert.AreNotEqual(response, null);
        }
Example #3
0
 public TraitifyClient()
 {
     if(_host == "add_api_host")
     {
         throw new Exception("Please add the API host and your API keys to TraitifyClient class that you created at developer.traitify.com");
     }
     else
     {
         _traitify = new Traitify(_host, _publicKey, _secretKey, "v1");
     }
 }
Example #4
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                _traitify = new TraitifyClient().traitify;

                List<Deck> decks = _traitify.GetDecks();
                comboBox1.DataSource = decks;
                comboBox1.DisplayMember = "Name";
                comboBox1.ValueMember = "id";
            }
            catch (Exception ex)
            {
                btnGo.Enabled = false;
                MessageBox.Show(ex.Message.ToString());
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Use this console app to test Traitify APIs");
            Console.WriteLine("Type hostname and hit enter:");
            string hostname = Console.ReadLine();
            Console.WriteLine("Type Public Key and hit enter:");
            string publicKey = Console.ReadLine();
            Console.WriteLine("Type Secret Key and hit enter:");
            string secretKey = Console.ReadLine();

            Traitify traitify = new Traitify(hostname, publicKey, secretKey, "v1");

            Console.WriteLine("Type DeckId and hit enter:");
            string deckId = Console.ReadLine();

            Assessment assess = traitify.CreateAssesment(deckId);

            Console.WriteLine("The AssesmentId is " + assess.id);

            Console.WriteLine("Press Any key to quit:");
            Console.ReadLine();
        }
        public void testSlideBulkUpdate() 
        {
            Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1");
            
            Assessment assessment = createAssessment();
            List<Slide> slides = listSlides(assessment.id);

            foreach (Slide slide in slides)
            {
                slide.response = true;
                slide.time_taken = 600;
                Assert.AreEqual(slide.completed_at, null);
            }

            slides = traitify.SetSlideBulkUpdate(assessment.id, slides);

            Assert.AreNotEqual(slides, null);

            foreach (Slide slide in slides)
            {
                Assert.AreNotEqual(slide.completed_at, null);
            }
        }
        public void TestSlideUpdate()
        {
            Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1");

            Assessment assessment = createAssessment();
            List<Slide> slides = listSlides(assessment.id);
            Slide slide = slides[0];

            slide.response = true;
            slide.time_taken = 600;

            slide = traitify.SetSlideUpdate(assessment.id, slide);

            Assert.AreEqual(slide.time_taken, 600);
            Assert.AreEqual(slide.response, true);
            Assert.AreNotEqual(slide.completed_at, null);
        }
        public List<AssessmentPersonalityType> listAssessmentPersonalityTypes(String assessment_id)
        {
            Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1"); 

            updateAllSlides(assessment_id);

            List<AssessmentPersonalityType> personalityTypes = traitify.GetPersonalityTypes(assessment_id).personality_types;

            Assert.AreNotEqual(personalityTypes, null);

            return personalityTypes;
        }
        private List<Slide> updateAllSlides(String assessment_id)
        {
            Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1"); 

            List<Slide> slides = listSlides(assessment_id);
            Random rng = new Random();
            
            Random random = new Random();
            foreach (Slide slide in slides){
                slide.response = (rng.Next(0, 2) > 0);
                slide.time_taken = 600;
                Assert.AreEqual(slide.completed_at, null);
            }

            return traitify.SetSlideBulkUpdate(assessment_id, slides);
        }
 private List<Slide> listSlides(String assessment_id)
 {
     Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1");
     List<Slide> slides = traitify.GetSlides(assessment_id);
     Assert.AreNotEqual(slides, null);
     return slides;
 }
 private Assessment createAssessment(Deck deck)
 {
     Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1");
     Assessment assessment = traitify.CreateAssesment(deck.id);
     Assert.AreNotEqual(assessment, null);
     return assessment;
 }
 private List<Deck> listDecks()
 {
     Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1");
     return traitify.GetDecks();
 }
        public void TestPersonalityTraits()
        {
            Traitify traitify = new Traitify(_host, _publicKey, _secretKey, "v1");

            Assessment assessment = createAssessment();

            List<AssessmentPersonalityTrait> assessmentPersonalityTraits = traitify.GetPersonalityTraits(assessment.id);

            Assert.AreNotEqual(assessmentPersonalityTraits, null);
            Assert.AreNotSame(assessmentPersonalityTraits.Count, 0);
        }