NUnit.Framework.Assert.Null(object, string)

Here are the examples of the csharp api class NUnit.Framework.Assert.Null(object, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

12 Examples 7

1. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPreProcessorThrowsException()
        {
            try
            {
                PreProcessHandlerLocal handler = new PreProcessHandlerLocal();
                Config.SetPreProcessHandler(new PreProcessHandler(handler.PreProcess));
                string request = @"{method:'TestPreProcessorThrowsException',params:{inputValue:'some string'},id:1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                StringAssert.Contains("-32603", result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPreProcessHandler(null);
            }
        }

2. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPostProcessorSetsException()
        {
            try
            {
                PostProcessHandlerLocal handler = new PostProcessHandlerLocal(false);
                Config.SetPostProcessHandler(new PostProcessHandler(handler.PostProcess));
                string request = @"{method:'TestPostProcessorSetsException',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-27001,\"message\":\"This exception was thrown using: JsonRpcContext.SetException()\",\"data\":null},\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPreProcessHandler(null);
            }
        }

3. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPreProcessorThrowsJsonRPCException()
        {
            try
            {
                PreProcessHandlerLocal handler = new PreProcessHandlerLocal();
                Config.SetPreProcessHandler(new PreProcessHandler(handler.PreProcess));
                string request = @"{method:'TestPreProcessorThrowsJsonRPCException',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-27000,\"message\":\"Just some testing\",\"data\":null},\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPreProcessHandler(null);
            }
        }

4. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPreProcessorSetsException()
        {
            try
            {
                PreProcessHandlerLocal handler = new PreProcessHandlerLocal();
                Config.SetPreProcessHandler(new PreProcessHandler(handler.PreProcess));
                string request = @"{method:'TestPreProcessorSetsException',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-27000,\"message\":\"This exception was thrown using: JsonRpcContext.SetException()\",\"data\":null},\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPreProcessHandler(null);
            }
        }

5. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPreProcessor()
        {
            try {
                PreProcessHandlerLocal handler = new PreProcessHandlerLocal();
                Config.SetPreProcessHandler(new PreProcessHandler(handler.PreProcess));
                string request = @"{method:'TestPreProcessor',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"result\":\"Success!\",\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.Null(handler.context, "Context should be null");
            } finally {
                Config.SetPreProcessHandler(null);
            }

        }

6. Example

Project: xenadmin
Source File: MainWindowTester.cs
View license
protected void CheckMenuItemMissing(string menuName, string itemName)
        {
            MW(delegate()
            {
                ToolStripItem item = GetMenuItem(menuName, itemName);
                Assert.Null(item, string.Format("Did not expect to find menu item '{0}' under menu '{1}'", itemName, menuName));
            });
        }

7. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPostProcessor()
        {
            try
            {
                PostProcessHandlerLocal handler = new PostProcessHandlerLocal(false);
                Config.SetPostProcessHandler(new PostProcessHandler(handler.PostProcess));
                string request = @"{method:'TestPostProcessor',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"result\":\"Success!\",\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run, "Expect number of times run 1");
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.NotNull(handler.response, "response should not be null");
                Assert.AreEqual("Success!", (string)handler.response.Result);
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPostProcessHandler(null);
            }
        }

8. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPostProcessorThrowsExceptionChangesReturn()
        {
            try
            {
                PostProcessHandlerLocal handler = new PostProcessHandlerLocal(true);
                Config.SetPostProcessHandler(new PostProcessHandler(handler.PostProcess));
                string request = @"{method:'TestPostProcessorThrowsException',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"Test error\",\"code\":-123,\"data\":null},\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.NotNull(handler.response, "response should not be null");
                Assert.Null(handler.response.Result, "Result should be null");
                Assert.NotNull(handler.response.Error, "Error should not be null");
                Assert.AreEqual(-32603, handler.response.Error.code, "Error code mismatch");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPostProcessHandler(null);
            }
        }

9. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPostProcessorChangesReturn()
        {
            try
            {
                PostProcessHandlerLocal handler = new PostProcessHandlerLocal(true);
                Config.SetPostProcessHandler(new PostProcessHandler(handler.PostProcess));
                string request = @"{method:'TestPostProcessor',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-123,\"message\":\"Test error\",\"data\":null},\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.AreEqual(1, handler.run, "Expect number of times run 1");
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.NotNull(handler.response, "response should not be null");
                Assert.AreEqual("Success!", (string)handler.response.Result);
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPostProcessHandler(null);
            }
        }

10. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPostProcessorThrowsJsonRPCException()
        {
            try
            {
                PostProcessHandlerLocal handler = new PostProcessHandlerLocal(false);
                Config.SetPostProcessHandler(new PostProcessHandler(handler.PostProcess));
                string request = @"{method:'TestPostProcessorThrowsJsonRPCException',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-27000,\"message\":\"Just some testing\",\"data\":null},\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.NotNull(handler.response, "response should not be null");
                Assert.Null(handler.response.Result, "Result should be null");
                Assert.NotNull(handler.response.Error, "Error should not be null");
                Assert.AreEqual(-27000, handler.response.Error.code, "Error code mismatch");
                Assert.AreEqual("Just some testing", handler.response.Error.message, "Error message mismatch");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPostProcessHandler(null);
            }
        }

11. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPostProcessorThrowsJsonRPCExceptionChangesReturn()
        {
            try
            {
                PostProcessHandlerLocal handler = new PostProcessHandlerLocal(true);
                Config.SetPostProcessHandler(new PostProcessHandler(handler.PostProcess));
                string request = @"{method:'TestPostProcessorThrowsJsonRPCException',params:{inputValue:'some string'},id:1}";
                string expectedResult = "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-123,\"message\":\"Test error\",\"data\":null},\"id\":1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                AssertJsonAreEqual(expectedResult, result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.NotNull(handler.response, "response should not be null");
                Assert.Null(handler.response.Result, "Result should be null");
                Assert.NotNull(handler.response.Error, "Error should not be null");
                Assert.AreEqual(-27000, handler.response.Error.code, "Error code mismatch");
                Assert.AreEqual("Just some testing", handler.response.Error.message, "Error message mismatch");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPostProcessHandler(null);
            }
        }

12. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
[Test()]
        public void TestPostProcessorThrowsException()
        {
            try
            {
                PostProcessHandlerLocal handler = new PostProcessHandlerLocal(false);
                Config.SetPostProcessHandler(new PostProcessHandler(handler.PostProcess));
                string request = @"{method:'TestPostProcessorThrowsException',params:{inputValue:'some string'},id:1}";
                var result = JsonRpcProcessor.Process(request);
                result.Wait();
                StringAssert.Contains("-32603", result.Result);
                Assert.AreEqual(1, handler.run);
                Assert.NotNull(handler.rpc, "RPC should not be null");
                Assert.NotNull(handler.response, "response should not be null");
                Assert.Null(handler.response.Result, "Result should be null");
                Assert.NotNull(handler.response.Error, "Error should not be null");
                Assert.AreEqual(-32603, handler.response.Error.code, "Error code mismatch");
                Assert.Null(handler.context, "Context should be null");
            }
            finally
            {
                Config.SetPostProcessHandler(null);
            }
        }