Esempio n. 1
0
        public void UpdateById_ValidObjectId_ShouldUpdateAndReturnTrue()
        {
            _gigRepository.Add(_testGigOne);
            _gigRepository.Add(_testGigTwo);

            // Change values now inserted
            _testGigOne.Artist = "Radiohead";
            _testGigOne.Venue  = "Sheffield";
            _testGigOne.Date   = new DateTime(2019, 4, 18);
            _testGigOne.TicketUrls.Add("http://stackoverflow.com");

            // Update the record
            var result = _gigRepository.UpdateById(_testGigOne.Id, _testGigOne);

            // Validate
            Assert.IsTrue(result);

            var recordFromDatabase = _mongoDatabaseUtilities.FindRecordById(_testGigOne.Id);

            GigAssertor.New()
            .Expected(_testGigOne)
            .Actual(recordFromDatabase[0])
            .DoAssert();
        }