public void UpdateAuthor_with_values_saves_all_data_correctly() { Author author = new AnonymousAuthorBuilder().build(); Console.WriteLine("author.Id = {0}", author.Id); //save the author to the webshop string result = WebMethods.AuthorMethods.UpdateAuthor(author); result = XElement.Parse(result).Value; Assert.IsTrue(result == "ok", string.Format("Author with id {0} could not be created/updated. Unexpected return value was: {1}", author.Id, result)); //retrieve the author from the webshop string errorMsg; Author authorFromWS = WebMethods.AuthorMethods.GetAuthorById(author.Id, out errorMsg); //compare all values Assert.AreEqual(author.Id, authorFromWS.Id, "The field comparison for field \"id\" failed."); Assert.AreEqual(author.Name, authorFromWS.Name, "The field comparison for field \"name\" failed."); Assert.AreEqual(author.Test, authorFromWS.Test, "The field comparison for field \"test\" failed."); //Assert.AreEqual(author.CreatedDttm, authorFromWS.CreatedDttm, "The field comparison for field \"created\" failed."); //Assert.AreEqual(author.UpdatedDttm, authorFromWS.UpdatedDttm, "The field comparison for field \"updated\" failed."); //Assert.AreEqual(author.DeletedDttm, authorFromWS.DeletedDttm, "The field comparison for field \"deleted\" failed."); }
public void UpdateAuthor_creates_new_author_and_returns_ok() { Author author = new AnonymousAuthorBuilder().build(); string result = WebMethods.AuthorMethods.UpdateAuthor(author); result = XElement.Parse(result).Value; Assert.IsTrue(result == "ok", string.Format("Author with id {0} could not be created/updated. Unexpected return value was: {1}", author.Id, result)); }
public void DeleteAuthorById_with_valid_id_returns_ok() { Author author = new AnonymousAuthorBuilder().build(); string result = WebMethods.AuthorMethods.UpdateAuthor(author); Assert.IsTrue(XElement.Parse(result).Value == "ok", string.Format("Author with id {0} could not be created or updated; test aborted.", author.Id)); result = WebMethods.AuthorMethods.DeleteAuthorById(author.Id); result = XElement.Parse(result).Value; Assert.IsTrue(result == "ok", string.Format("Author with id {0} could not be deleted. Unexpected resturn value was: {1}", author.Id, result)); }