public void Setup()
 {
     LoggerMock     = new Mock <ILogger>();
     HttpClientMock = new Mock <HttpProjectConfigManager.HttpClient>();
     HttpClientMock.Reset();
     TestHttpProjectConfigManagerUtil.SetClientFieldValue(HttpClientMock.Object);
     LoggerMock.Setup(l => l.Log(It.IsAny <LogLevel>(), It.IsAny <string>()));
     NotificationCallbackMock.Setup(nc => nc.TestConfigUpdateCallback());
 }
예제 #2
0
        public void TestGetFeatureVariableJSONEmptyDatafileTest()
        {
            var httpClientMock = new Mock <HttpProjectConfigManager.HttpClient>();
            var task           = TestHttpProjectConfigManagerUtil.MockSendAsync(httpClientMock, TestData.EmptyDatafile, TimeSpan.Zero, System.Net.HttpStatusCode.OK);

            TestHttpProjectConfigManagerUtil.SetClientFieldValue(httpClientMock.Object);

            var optimizely = OptimizelyFactory.NewDefaultInstance("sdk-key");

            Assert.Null(optimizely.GetFeatureVariableJSON("no-feature-variable", "no-variable-key", "userId"));
            optimizely.Dispose();
        }
 public Task MockSendAsync(string datafile = null, TimeSpan?delay = null, HttpStatusCode statusCode = HttpStatusCode.OK)
 {
     return(TestHttpProjectConfigManagerUtil.MockSendAsync(HttpClientMock, datafile, delay, statusCode));
 }