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); }
public void ReturnCacheResourceResult() { 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 CacheControlDecorator); }
public void ReturnThreeParameterKeys() { var resource = new AjaxResource(); Assert.Equal(3, resource.Parameters.Count()); }
public void ThrowExceptionWithNullParameters() { var resource = new AjaxResource(); Assert.Throws <ArgumentNullException>(() => resource.Execute(null)); }
public void ProvideProperName() { var resource = new AjaxResource(); Assert.Equal("glimpse_ajax", resource.Name); }