Exemple #1
0
        [Fact]//SaveHaikuDTO.cs
        public void SaveHaikuDTOTest1()
        {
            SaveHaikuDTO shd = new SaveHaikuDTO();

            shd.haikuLine1  = "HA";
            shd.haikuLine2  = "BA";
            shd.haikuLine3  = "GA";
            shd.tags        = "something";
            shd.username    = "******";
            shd.currentuser = "******";
            var expected = true;
            var actual   = (shd.haikuLine1 != null && shd.haikuLine2 != null && shd.haikuLine3 != null && shd.tags != null && shd.username != null && shd.currentuser != null);

            Assert.Equal(expected, actual);
        }
Exemple #2
0
        public ActionResult <Boolean> SaveHaikuToFavorites([FromBody] SaveHaikuDTO haiku)
        {
            Haiku newhaiku = new Haiku {
                HaikuLine1 = haiku.haikuLine1,
                HaikuLine2 = haiku.haikuLine2,
                HaikuLine3 = haiku.haikuLine3,
                Tags       = haiku.tags,
                Approved   = true,
                Username   = haiku.username
            };

            string currentusername = haiku.currentuser;

            bool saveSuccessful = _haikuMethod.SaveHaikuToFavorites(currentusername, newhaiku);

            return(saveSuccessful);
        }