Example #1
0
        public void Save_InsertReadUpdateFlow_WorksCorrectly()
        {
            var album = new Album
            {
                Description = "My album description",
                Name = "My album name",
                PhotographerId = 1000001
            };
            //insert album
            var newId = mapper.Save(album);
            var insertedAlbum = mapper.GetBy(newId);
            var dateCreated = insertedAlbum.DateCreated;
            Assert.AreEqual("My album description", insertedAlbum.Description);
            Assert.AreEqual("My album name", insertedAlbum.Name);
            Assert.AreEqual(1000001, insertedAlbum.PhotographerId);
            Assert.AreEqual(newId, insertedAlbum.Id);

            //update album
            insertedAlbum.Description = "Updated description";
            insertedAlbum.Name = "Updated name";

            var insertedId = mapper.Save(insertedAlbum);
            var updatedAlbum = mapper.GetBy(insertedId);
            Assert.AreEqual("Updated description", updatedAlbum.Description);
            Assert.AreEqual("Updated name", updatedAlbum.Name);
            Assert.AreEqual(1000001, updatedAlbum.PhotographerId);
            Assert.AreEqual(insertedId, updatedAlbum.Id);
            Assert.AreEqual(dateCreated, updatedAlbum.DateCreated);
        }
Example #2
0
 public void Save_ExistingAlbum_ReturnTheExistingId()
 {
     var album = new Album
     {
         Id = 2000001,
         Description = "My weddings Update",
         Name = "Weddings Update",
         PhotographerId = 1000001
     };
     var newId = mapper.Save(album);
     Assert.AreEqual(2000001, newId);
 }
Example #3
0
 private void VerifyAlbum(Album album)
 {
     Assert.NotNull(album);
     Assert.AreEqual(2000000, album.Id);
     Assert.AreEqual("My photos", album.Name);
     Assert.AreEqual("These are my photos", album.Description);
     Assert.AreNotEqual(default(DateTime), album.DateCreated);
 }
Example #4
0
 public void Save_NewAlbum_ReturnNewId()
 {
     var album = new Album
                     {
                         Description = "Test description",
                         Name = "Test album",
                         PhotographerId = 1000001
                     };
     var newId = mapper.Save(album);
     Assert.Greater(newId, default(int));
 }