Exemplo n.º 1
0
        public void AddingTheSameValueUpdatesThatValue()
        {
            var context = new PhraseContext();

            context.Add("name", "Bob");
            context.Add("name", "Joe");
            Assert.Equal("Joe", context.GetValue <string>("name"));
        }
Exemplo n.º 2
0
        public void CanAddAndRetrievePropertiesToContext()
        {
            var context = new PhraseContext();

            context.Add("name", "Bob");
            context.Add("age", 15);
            Assert.Equal("Bob", context.GetValue <string>("name"));
            Assert.Equal(15, context.GetValue <int>("age"));
        }
Exemplo n.º 3
0
        public void CanCreateAnObjectWithPropertiesForValues()
        {
            var context = new PhraseContext();

            context.Add("name", "Bob");
            context.Add("age", 28);

            dynamic obj = context.CreateObject();

            Assert.Equal("Bob", obj.name);
            Assert.Equal(28, obj.age);
        }
Exemplo n.º 4
0
        internal void SaveChanges(Grid loadingIndicatorPanel)
        {
            Dispatcher?.Invoke(() =>
            {
                loadingIndicatorPanel.Visibility = Visibility.Visible;
                try
                {
                    _context.Add(new Phrase
                    {
                        English   = CurrentPhrase.English,
                        Hungarian = CurrentPhrase.Hungarian
                    });

                    if (_context.ChangeTracker.HasChanges())
                    {
                        _context.SaveChanges();
                        // TODO Notification Changes are done!
                    }

                    // TODO Notification Nothing to changed!
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                    // TODO Notification Error!
                    throw;
                }

                loadingIndicatorPanel.Visibility = Visibility.Hidden;
            });
        }