Example #1
0
        public void ReturnStatusCodeResourceResultWithMissingParameter()
        {
            var contextMock = new Mock<IResourceContext>();
            contextMock.Setup(c => c.Parameters).Returns(new Dictionary<string, string> { {"parentRequestId", "bad data"} });

            var resource = new AjaxResource();

            var result = resource.Execute(contextMock.Object);

            Assert.NotNull(result as StatusCodeResourceResult);
        }
Example #2
0
        public void ReturnJsonResourceResult()
        {
            var contextMock = new Mock<IResourceContext>();

            var guid = Guid.NewGuid();

            var output = guid.ToString();

            contextMock.Setup(c => c.Parameters.TryGetValue("parentRequestId", out output)).Returns(true);
            contextMock.Setup(c => c.PersistenceStore.GetByRequestParentId(guid)).Returns(Enumerable.Empty<GlimpseRequest>());

            var resource = new AjaxResource();

            var result = resource.Execute(contextMock.Object);

            Assert.NotNull(result as JsonResourceResult);
        }
Example #3
0
        public void ThrowExceptionWithNullParameters()
        {
            var resource = new AjaxResource();

            Assert.Throws<ArgumentNullException>(() => resource.Execute(null));
        }