コード例 #1
0
        public void ShouldAddGetDeleteMark()
        {
            //arrange
            var mark = new Mark
            {
                UserId = Guid.Parse("3c8fddae-8ebc-4cd4-9eb2-30ce678d6c23") /*Guid.NewGuid()*/,
                PostId = Guid.Parse("82243a65-d1e6-440c-a906-5dffb9cd653c") /*Guid.NewGuid()*/,
            };
            //act
            var dataLayer  = new DataLayer.Sql.DataLayer(_connectionString);
            var addMark    = dataLayer.AddMark(mark);
            var dataLayer1 = new DataLayer.Sql.DataLayer(_connectionString);
            var getMark    = dataLayer1.GetMark(addMark.MarkId);
            var dataLayer2 = new DataLayer.Sql.DataLayer(_connectionString);
            int isDeleted  = dataLayer2.DeleteMark(getMark.MarkId);

            //asserts
            Assert.AreEqual(addMark.MarkId, getMark.MarkId);
            Assert.AreEqual(addMark.UserId, getMark.UserId);
            Assert.AreEqual(addMark.PostId, getMark.PostId);
            Assert.IsNotNull(isDeleted);
        }