예제 #1
0
        public void DeleteNotificationAction()
        {
            this.CreateInboxHelperAsync().Wait();
            this.PostNotificationHelper(this.controller).Wait();
            var inbox = this.GetInboxItemsAsyncHelper().Result;

            this.controller.DeleteAsync(this.inboxId, inbox.Items[0].Location.AbsoluteUri).GetAwaiter().GetResult();

            var blobReference = this.container.GetBlockBlobReference(inbox.Items[0].Location.AbsoluteUri);

            Assert.False(blobReference.DeleteIfExists(), "The blob should have already been deleted.");
            inbox = this.GetInboxItemsAsyncHelper().Result;
            Assert.Empty(inbox.Items);
        }
예제 #2
0
        public async Task <JsonResult> CreateAsync()
        {
            var inbox = InboxEntity.Create();

            this.InboxTable.AddObject(inbox);
            await this.InboxTable.SaveChangesWithMergeAsync(inbox);

            string messageReceivingEndpoint = this.GetAbsoluteUrlForAction("Slot", new { id = inbox.RowKey }).AbsoluteUri;
            var    result = new InboxCreationResponse {
                MessageReceivingEndpoint = messageReceivingEndpoint,
                InboxOwnerCode           = inbox.InboxOwnerCode,
            };

            return(new JsonResult {
                Data = result
            });
        }
예제 #3
0
        private async Task CreateInboxHelperAsync()
        {
            var jsonResult = await this.controller.CreateAsync();

            var result = (InboxCreationResponse)jsonResult.Data;

            this.inbox = result;

            var routes = new RouteCollection();

            RouteConfig.RegisterRoutes(routes);
            var httpContextMock = new Mock <HttpContextBase>();

            httpContextMock.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath)
            .Returns("~" + new Uri(result.MessageReceivingEndpoint).PathAndQuery);     // POST
            var routeData = routes.GetRouteData(httpContextMock.Object);

            this.inboxId = (string)routeData.Values["id"];
        }
예제 #4
0
		private async Task CreateInboxHelperAsync() {
			var jsonResult = await this.controller.CreateAsync();
			var result = (InboxCreationResponse)jsonResult.Data;
			this.inbox = result;

			var routes = new RouteCollection();
			RouteConfig.RegisterRoutes(routes);
			var httpContextMock = new Mock<HttpContextBase>();
			httpContextMock.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath)
				.Returns("~" + new Uri(result.MessageReceivingEndpoint).PathAndQuery); // POST
			var routeData = routes.GetRouteData(httpContextMock.Object);
			this.inboxId = (string)routeData.Values["id"];
		}
예제 #5
0
		public void DeleteNotificationAction() {
			this.CreateInboxHelperAsync().Wait();
			this.PostNotificationHelper().Wait();
			var inbox = this.GetInboxItemsAsyncHelper().Result;
			this.controller.DeleteAsync(this.inboxId, inbox.Items[0].Location.AbsoluteUri).GetAwaiter().GetResult();

			var blobReference = this.container.GetBlockBlobReference(inbox.Items[0].Location.AbsoluteUri);
			Assert.That(blobReference.DeleteIfExists(), Is.False, "The blob should have already been deleted.");
			inbox = this.GetInboxItemsAsyncHelper().Result;
			Assert.That(inbox.Items, Is.Empty);
		}
예제 #6
0
        public async Task<JsonResult> CreateAsync()
        {
            var inbox = InboxEntity.Create();
            this.InboxTable.AddObject(inbox);
            await this.InboxTable.SaveChangesWithMergeAsync(inbox);

            string messageReceivingEndpoint = this.GetAbsoluteUrlForAction("Slot", new { id = inbox.RowKey }).AbsoluteUri;
            var result = new InboxCreationResponse
            {
                MessageReceivingEndpoint = messageReceivingEndpoint,
                InboxOwnerCode = inbox.InboxOwnerCode,
            };
            return new JsonResult { Data = result };
        }