public void Test_Exception() { // Prepare RemotingServer server = this._Provider.GetRequiredService <RemotingServer>(); server.Start(); IMyService service = this._Provider.GetRequiredService <IMyService>(); // Pre-validate Assert.True(server != null && service != null); // Perform Exception ex = Assert.Throws <Exception>(() => { service.CheckUnitNotNull(null); }); // Post-validate Assert.Equal("Value cannot be null.\r\nParameter name: Argument must declared!", ex.Message); }