Exemple #1
0
        public async Task Check03DetailDirectPostWhereOk()
        {
            using (var db = new SampleWebAppDb())
            {
                //SETUP
                var service   = new DetailServiceAsync <Post>(db);
                var firstPost = db.Posts.First();

                //ATTEMPT
                var status = await service.GetDetailUsingWhereAsync(x => x.PostId == firstPost.PostId);

                //VERIFY
                status.IsValid.ShouldEqual(true, status.Errors);
                status.Result.PostId.ShouldEqual(firstPost.PostId);
                status.Result.Title.ShouldEqual(firstPost.Title);
            }
        }
Exemple #2
0
        public async Task Check05DetailDirectPostNotFoundBad()
        {
            using (var db = new SampleWebAppDb())
            {
                //SETUP
                var service = new DetailServiceAsync <Post>(db);

                //ATTEMPT
                var status = await service.GetDetailUsingWhereAsync(x => x.PostId == 0);

                //VERIFY
                status.IsValid.ShouldEqual(false, status.Errors);
                status.Errors.Count.ShouldEqual(1);
                status.Errors[0].ErrorMessage.ShouldEqual("We could not find an entry using that filter. Has it been deleted by someone else?");
                status.Result.ShouldNotEqualNull();
            }
        }
        public async Task Check03DetailDirectPostWhereOk()
        {
            using (var db = new SampleWebAppDb())
            {
                //SETUP
                var service = new DetailServiceAsync<Post>(db);
                var firstPost = db.Posts.First();

                //ATTEMPT
                var status = await service.GetDetailUsingWhereAsync(x => x.PostId == firstPost.PostId);

                //VERIFY
                status.IsValid.ShouldEqual(true, status.Errors);
                status.Result.PostId.ShouldEqual(firstPost.PostId);
                status.Result.Title.ShouldEqual(firstPost.Title);
            }
        }
        public async Task Check05DetailDirectPostNotFoundBad()
        {
            using (var db = new SampleWebAppDb())
            {
                //SETUP
                var service = new DetailServiceAsync<Post>(db);

                //ATTEMPT
                var status = await service.GetDetailUsingWhereAsync(x => x.PostId == 0);

                //VERIFY
                status.IsValid.ShouldEqual(false, status.Errors);
                status.Errors.Count.ShouldEqual(1);
                status.Errors[0].ErrorMessage.ShouldEqual("We could not find an entry using that filter. Has it been deleted by someone else?");
                status.Result.ShouldNotEqualNull();
            }
        }