コード例 #1
0
        public void TestEventCRUD()
        {
            IEvent e    = CreateEvent(EventType.Wedding);
            var    ep   = new EventProcessor(e);
            var    save = ep.Create().Result;

            Assert.IsTrue(save.Data != null && save.Data.Id != Guid.Empty, "Event save failed.");

            var one = ep.FetchById().Result;

            Assert.IsTrue(one.Data != null, "Event fetch failed.");

            var delete = ep.Delete().Result;

            one = ep.FetchById().Result;
            Assert.IsTrue(one.Data == null, "Event delete failed.");

            var vp = new VendorProcessor(e.Arrangements[0].Vendor.Id);
            var d  = vp.Delete().Result;
            var o  = vp.FetchById().Result;

            Assert.IsTrue(o.Data == null, "Vendor delete failed.");

            var uHelper = new UserProcessor(e.Arrangements[0].Vendor.Id);
            var uOne    = uHelper.FetchById().Result;

            Assert.IsTrue(uOne.Data == null, "User not deleted from vendor delete.");
        }
コード例 #2
0
        public void TestProjectCRUD()
        {
            IProject p = CreateProject();

            var pp   = new ProjectProcessor(p);
            var save = pp.Create().Result;

            Assert.IsTrue(save.Data != null && save.Data.Id != Guid.Empty, "Project save failed.");

            var one = pp.FetchById().Result;

            Assert.IsTrue(one.Data != null, "Project fetch failed.");

            var eHelper = new EventProcessor(p.Events[0].Id);
            var eOne    = eHelper.FetchById().Result;

            Assert.IsTrue(eOne.Data != null, "Event fetch failed.");

            var delete = pp.Delete().Result;

            one = pp.FetchById().Result;
            Assert.IsTrue(one.Data == null, "Project delete failed.");

            eOne = eHelper.FetchById().Result;
            Assert.IsTrue(eOne.Data == null, "Event delete failed from Project.");

            var vhelper = new VendorProcessor(p.Events[0].Arrangements[0].Vendor.Id);

            delete = vhelper.Delete().Result;

            var vendor = vhelper.FetchById().Result;

            Assert.IsTrue(one.Data == null, "Vendor delete failed.");

            var uHelper = new UserProcessor(p.Events[0].Arrangements[0].Vendor.Id);
            var user    = uHelper.FetchById().Result;

            Assert.IsTrue(user.Data == null, "User not deleted from vendor delete.");
        }
コード例 #3
0
        public async Task <HttpResponseMessage> Get(Guid id)
        {
            if (id != Guid.Empty)
            {
                var ep = new EventProcessor(id);
                var e  = await ep.FetchById();

                if (e.Data != null)
                {
                    return(new HttpResponseMessage()
                    {
                        Content = new StringContent(JsonConvert.SerializeObject(e.Data))
                    });
                }
                else
                {
                    return(new HttpResponseMessage(System.Net.HttpStatusCode.NotFound));
                }
            }
            return(new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest));
        }