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 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); }
public void ThrowExceptionWithNullParameters() { var resource = new AjaxResource(); Assert.Throws<ArgumentNullException>(() => resource.Execute(null)); }