コード例 #1
0
        public async Task CanSaveAndGetSocialField()
        {
            var db  = GetSut();
            var sut = new CustomFieldRepository(db);

            await sut.SaveSocial(new SocialField {
                AuthorId = 0,
                Title    = "Facebook",
                Icon     = "fa-facebook",
                Name     = "social|facebook|1",
                Rank     = 1,
                Content  = "http://your.facebook.page.com"
            });

            var socials = await sut.GetSocial();

            Assert.NotNull(socials);

            var result = sut.Single(f => f.Name.Contains("social|facebook"));

            Assert.NotNull(result);

            sut.Remove(result);
            await db.SaveChangesAsync();

            result = sut.Single(f => f.Name.Contains("social|facebook"));
            Assert.Null(result);
        }