Esempio n. 1
0
        public void SetStringValue()
        {
            var dc = new DictionaryContainerPoker();

            Assert.Throws <ArgumentNullException> (delegate {
                dc.SetStringValue_(null, String.Empty);
            }, "null key");

            dc.SetStringValue_(key, (NSString)"monkey");
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(1), "1");

            dc.SetStringValue_(key, null);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "0");
        }
Esempio n. 2
0
        public void SetNumberValue_UInt32()
        {
            var dc = new DictionaryContainerPoker();

            Assert.Throws <ArgumentNullException> (delegate {
                dc.SetNumberValue_(null, uint.MaxValue);
            }, "null key");

            dc.SetNumberValue_(key, uint.MaxValue);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(1), "1");

            dc.SetNumberValue_(key, (uint?)null);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "0");
        }
Esempio n. 3
0
        public void SetBooleanValue()
        {
            var dc = new DictionaryContainerPoker();

            Assert.Throws <ArgumentNullException> (delegate {
                dc.SetBooleanValue_(null, true);
            }, "null key");

            dc.SetBooleanValue_(key, true);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(1), "1");

            dc.SetBooleanValue_(key, null);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "0");
        }
Esempio n. 4
0
        public void SetArrayValue_NSNumber()
        {
            var numbers = new NSNumber [] { (NSNumber)0, (NSNumber)1 };
            var dc      = new DictionaryContainerPoker();

            Assert.Throws <ArgumentNullException> (delegate {
                dc.SetArrayValue_(null, numbers);
            }, "null key");

            dc.SetArrayValue_(key, numbers);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(1), "1");
            Assert.That((int)(dc.Dictionary [key] as NSArray).Count, Is.EqualTo(2), "2");

            numbers = null;
            dc.SetArrayValue_(key, numbers);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "0");
        }
Esempio n. 5
0
        public void SetArrayValue_INativeObject()
        {
            var native = new INativeObject [] { new CFString("xamarin"), CFRunLoop.Main };
            var dc     = new DictionaryContainerPoker();

            Assert.Throws <ArgumentNullException> (delegate {
                dc.SetArrayValue_(null, native);
            }, "null key");

            dc.SetArrayValue_(key, native);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(1), "1");
            Assert.That((int)(dc.Dictionary [key] as NSArray).Count, Is.EqualTo(2), "2");

            native = null;
            dc.SetArrayValue_(key, native);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "0");
        }
Esempio n. 6
0
        public void SetArrayValue_T_Enum()
        {
            var enums = new NSStringEncoding [] { NSStringEncoding.ISOLatin1, NSStringEncoding.ISOLatin2 };
            var dc    = new DictionaryContainerPoker();

            Assert.Throws <ArgumentNullException> (delegate {
                dc.SetArrayValue_(null, enums);
            }, "null key");

            dc.SetArrayValue_(key, enums);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(1), "1");
            Assert.That((int)(dc.Dictionary [key] as NSArray).Count, Is.EqualTo(2), "2");

            enums = null;
            dc.SetArrayValue_(key, enums);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "0");
        }
Esempio n. 7
0
        public void SetArrayValue_String()
        {
            var strings = new String [] { "xamarin", "monkeys" };
            var dc      = new DictionaryContainerPoker();

            Assert.Throws <ArgumentNullException> (delegate {
                dc.SetArrayValue_(null, strings);
            }, "null key");

            dc.SetArrayValue_(key, strings);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(1), "1");
            Assert.That((int)(dc.Dictionary [key] as NSArray).Count, Is.EqualTo(2), "2");

            strings = null;
            dc.SetArrayValue_(key, strings);
            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "0");
        }
Esempio n. 8
0
        public void Empty()
        {
            var dc = new DictionaryContainerPoker();

            Assert.That((int)dc.Dictionary.Count, Is.EqualTo(0), "Count");
        }