public void ShouldDeleteHashtag() { //arrange var user = GenerateUser(); var hashtag = Guid.NewGuid().ToString(); //act var dataLayer = new DataLayer.Sql.DataLayer(ConnectionSql); dataLayer.AddUser(user); var photo = GeneratePhoto(user.Id); dataLayer.AddPhoto(photo); var comment = GenerateComment(user.Id, photo.Id); dataLayer.AddComment(comment); comment = dataLayer.AddHashtag(comment, hashtag); dataLayer.DeleteHashtag(comment, hashtag); var haveHashtag = dataLayer.HaveHashtag(comment, hashtag); //assert Assert.AreEqual(haveHashtag, false); }
public void ShouldAddGetDeleteHashtag() { //arrange var hashtag = new Hashtag { PostId = Guid.Parse("82243a65-d1e6-440c-a906-5dffb9cd653c") /*Guid.NewGuid()*/, HashtagText = "#hashtag"/*Guid.NewGuid().ToString()*/ }; //act var dataLayer = new DataLayer.Sql.DataLayer(_connectionString); var addHashtag = dataLayer.AddHashtag(hashtag); var dataLayer1 = new DataLayer.Sql.DataLayer(_connectionString); var getHashtag = dataLayer1.GetHashtag(addHashtag.HashtagId); var dataLayer2 = new DataLayer.Sql.DataLayer(_connectionString); int isDeleted = dataLayer2.DeleteHashtag(getHashtag.HashtagId); //asserts Assert.AreEqual(addHashtag.HashtagId, getHashtag.HashtagId); Assert.AreEqual(addHashtag.PostId, getHashtag.PostId); Assert.AreEqual(addHashtag.HashtagText, getHashtag.HashtagText); Assert.IsNotNull(isDeleted); }