Пример #1
0
        private MutableDocument CreateDocumentWithTag(string id, string tag)
        {
            var doc = new MutableDocument(id);

            doc.SetString("tag", tag);

            doc.SetString("firstName", "Daniel");
            doc.SetString("lastName", "Tiger");

            var address = new MutableDictionary();

            address.SetString("street", "1 Main street");
            address.SetString("city", "Mountain View");
            address.SetString("state", "CA");
            doc.SetDictionary("address", address);

            var phones = new MutableArray();

            phones.AddString("650-123-0001").AddString("650-123-0002");
            doc.SetArray("phones", phones);

            doc.SetDate("updated", DateTimeOffset.UtcNow);

            return(doc);
        }
        public DesignFlightBookingViewModel()
        {
            var data = new MutableDictionary()
                       .SetString("destinationairport", "BBB")
                       .SetString("sourceairport", "AAA")
                       .SetString("date", DateTime.Now.ToString())
                       .SetDouble("price", 999.99)
                       .SetString("name", "Airplane Airlines")
                       .SetString("flight", "AB123");

            BookingsList.Add(new BookingCellModel(data));
        }
Пример #3
0
        public static void TestModifySimple()
        {
            MutableDictionary <int, int> dictionary = new MutableDictionary <int, int>();

            dictionary[0] = 0;
            dictionary[1] = 1;
            dictionary[2] = 2;
            dictionary[3] = 3;
            dictionary[4] = 4;

            foreach (var p in dictionary)
            {
                int value = p.Value;
                dictionary[p.Key] = value + 1;
                Assert.AreEqual(value + 1, dictionary[p.Key]);
            }
        }
        public MutableDictionaryTest()
        {
            _DictionarySwitcher = Substitute.For <IDictionaryStrategy>();
            DictionaryStrategyFactory <string> .Strategy = _DictionarySwitcher;

            _DictionaryFourElements = new MutableDictionary <string, string>
                                          (new Dictionary <string, string>()
            {
                { "Key0", "Value0" }, { "Key1", "Value1" },
                { "Key2", "Value2" }, { "Key3", "Value3" }
            });
            _DictionaryThreeElements = new MutableDictionary <string, string>
                                           (new Dictionary <string, string>()
            {
                { "Key0", "Value0" }, { "Key1", "Value1" },
                { "Key2", "Value2" }
            });
        }
        public void Constructor_ConstructEmptyDictionary()
        {
            var res = new MutableDictionary <string, string>();

            res.AsEnumerable().Should().BeEmpty();
        }