Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public void ThrowExceptionWithNullParameters()
        {
            var resource = new AjaxResource();

            Assert.Throws<ArgumentNullException>(() => resource.Execute(null));
        }
Пример #4
0
 public void ReturnThreeParameterKeys()
 {
     var resource = new AjaxResource();
     Assert.Equal(3, resource.Parameters.Count());
 }
Пример #5
0
 public void ProvideProperName()
 {
     var resource = new AjaxResource();
     Assert.Equal("glimpse_ajax", resource.Name);
 }