Ejemplo n.º 1
0
        public void Add_existing_key_modifies_value_in_dictionary()
        {
            Recorder.Recorder recorder = createStubRecorder();

            recorder.Add("test", 1);
            recorder.Add("test", 2);

            Assert.AreEqual(2, recorder.GetValueByKey("test"));
        }
Ejemplo n.º 2
0
        public void Clear_removes_all_values()
        {
            Recorder.Recorder recorder = createStubRecorder();

            recorder.Add("test", 1);
            recorder.Add("test2", 2);

            recorder.Clear();

            Assert.Throws(typeof(KeyNotFoundException), delegate() { recorder.GetValueByKey("test"); });
            Assert.Throws(typeof(KeyNotFoundException), delegate() { recorder.GetValueByKey("test2"); });
        }
Ejemplo n.º 3
0
        public void Add_unique_key_value_adds_to_dictionary()
        {
            Recorder.Recorder recorder = createStubRecorder();

            recorder.Add("test", 1);

            Assert.AreEqual(1, recorder.GetValueByKey("test"));
        }
Ejemplo n.º 4
0
        public void Drop_non_existant_key_for_dictionary_results_does_not_throw()
        {
            Recorder.Recorder recorder = createStubRecorder();

            recorder.Add("test", 1);
            recorder.DeleteByKey("Bob");

            // correct behaviour is no exception thrown
        }
Ejemplo n.º 5
0
        public void Drop_existant_key_for_dictionary_results_in_removal_from_dictionary()
        {
            Recorder.Recorder recorder = createStubRecorder();

            recorder.Add("test", 1);

            Assert.AreEqual(1, recorder.GetValueByKey("test"));

            recorder.DeleteByKey("test");

            Assert.Throws(typeof(KeyNotFoundException), delegate() { recorder.GetValueByKey("test"); });
        }
Ejemplo n.º 6
0
        public void Add_null_key_throws()
        {
            Recorder.Recorder recorder = createStubRecorder();

            Assert.Throws(typeof(ArgumentNullException), delegate() { recorder.Add(null, 1); });
        }