This property allows to override default behavior of all function that require
connection to cosmos.
It is introduced to enable enhanced unit testing of modules that use VcClientVC.
Namespace: VcClientAssembly: VcClient (in VcClient.dll) Version: 1.0.0.0 (1.8.400.4142)
Syntax
C# |
---|
public static VCOverride Override { get; } |
Visual Basic |
---|
Public Shared ReadOnly Property Override As VCOverride Get |
Visual C++ |
---|
public: static property VCOverride^ Override { VCOverride^ get (); } |
Examples
Production code:
Unit test code:
CopyC#
class SomeClassTest { public static bool MySetup() { try { VC.Setup("vc://cotest1/cosmosAdmin/", null, null); return true; } catch(HttpClientException) { return false; } } }
CopyC#
[TestClass()] class SomeClassTest { void SetupThrowingException(string vcName, string proxy, string userName) { throw new HttpClientException(""); } [TestMethod()] public void MySetupTest() { // Override default VC.Setup // VC.Override.Setup = SetupThrowingException; // Call method that calls VC.Setup; Assert.IsFalse(SomeClass.MySetup()); } }