Esempio n. 1
0
        public void Delete()
        {
            var widget = new Widget() {
            Description = "A widget",
            Expiration = DateTime.Now.AddYears(1),
            Name = "Widget",
            Price = 9.99m,
            Size = 2
              };

              var widgets = CreateBiggyList();
              widgets.Add(widget);
              widgets.Remove(widget);

              Assert.Equal(0, _dbVerifier.Count());
        }
Esempio n. 2
0
        public void Delete()
        {
            var widget = new Widget()
            {
                Description = "A widget",
                Expiration = DateTime.Now.AddYears(1),
                Name = "Widget",
                Price = 9.99m,
                Size = 2
            };

            var widgets = new MongoyList<Widget>(Host, Database, Collection);
            widgets.Add(widget);
            widgets.Remove(widget);

            Assert.Equal(0, _dbVerifier.Count());
        }
Esempio n. 3
0
        public void LoadSingleDocument()
        {
            var widget = new Widget() {
            Description = "A widget",
            Expiration = DateTime.Now.AddYears(1),
            Name = "Widget",
            Price = 9.99m,
            Size = 2
              };
              _dbVerifier.Insert(widget);

              var widgets = CreateBiggyList();
              Assert.Equal(1, widgets.Count());

              var found = widgets.First();
              Assert.Equal(widget.Description, found.Description);
              Assert.Equal(widget.Expiration.Year, found.Expiration.Year);
              Assert.Equal(widget.Name, found.Name);
              Assert.Equal(widget.Price, found.Price);
              Assert.Equal(widget.Size, found.Size);
        }
Esempio n. 4
0
        public void Update()
        {
            var widget = new Widget() {
            Description = "A widget",
            Expiration = DateTime.Now.AddYears(1),
            Name = "Widget",
            Price = 9.99m,
            Size = 2
              };

              var widgets = CreateBiggyList();
              widgets.Add(widget);

              widget.Name = "I updated this!!";
              widgets.Update(widget);

              var updatedWidget = _dbVerifier.Find(widget.Id);
              Assert.Equal(widget.Name, updatedWidget.Name);
        }
Esempio n. 5
0
        public void Update()
        {
            var widget = new Widget()
            {
                Description = "A widget",
                Expiration = DateTime.Now.AddYears(1),
                Name = "Widget",
                Price = 9.99m,
                Size = 2
            };

            var widgets = new MongoyList<Widget>(Host, Database, Collection);
            widgets.Add(widget);

            widget.Name = "I updated this!!";
            widgets.Flush();

            var updatedWidget = _dbVerifier.Find(widget.Id);
            Assert.Equal(widget.Name, updatedWidget.Name);
        }