Esempio n. 1
0
            public void DoesNotThrowForUnexpectedResponse()
            {
                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                                                      webClientStringToReturn: "some_error"));

                options.TryAddConfigurationFromServer("https://example.com");
            }
Esempio n. 2
0
            public void InvokesonExceptionWhenExceptionThrown()
            {
                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                                                      webClientStringToReturn: "error"));

                Exception actualException = null;

                options.TryAddConfigurationFromServer(
                    "https://example.com", (ex) => { actualException = ex; });

                Assert.NotNull(actualException);
                Assert.Equal(
                    "Unexpected character encountered while parsing value: "
                    + "e. Path '', line 0, position 0.",
                    actualException.Message);
            }
Esempio n. 3
0
            public void SetsSourceToserverBaseUrl()
            {
                const string ServerBaseUrl = "https://example.com";

                var stuntmanServerResponse = new StuntmanServerResponse
                {
                    Users = new[]
                    {
                        new StuntmanUser("user-1", "User 1")
                    }
                };

                var json = JsonConvert.SerializeObject(stuntmanServerResponse);

                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                                                      webClientStringToReturn: json));

                options.TryAddConfigurationFromServer(ServerBaseUrl);

                Assert.Equal(ServerBaseUrl, options.Users.Single().Source);
            }
Esempio n. 4
0
            public void ProcessesStuntmanServerResponse()
            {
                const string Id1 = "user-1";

                var stuntmanServerResponse = new StuntmanServerResponse
                {
                    Users = new[]
                    {
                        new StuntmanUser(Id1, "User 1")
                    }
                };

                var json = JsonConvert.SerializeObject(stuntmanServerResponse);

                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                                                      webClientStringToReturn: json));

                options.TryAddConfigurationFromServer("https://example.com");

                Assert.Equal(Id1, options.Users.Single().Id);
            }
Esempio n. 5
0
            public void InvokesonExceptionWhenExceptionThrown()
            {
                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                    webClientStringToReturn: "error"));

                Exception actualException = null;

                options.TryAddConfigurationFromServer(
                    "https://example.com", (ex) => { actualException = ex; });

                Assert.NotNull(actualException);
                Assert.Equal(
                    "Unexpected character encountered while parsing value: "
                        + "e. Path '', line 0, position 0.",
                    actualException.Message);
            }
Esempio n. 6
0
            public void SetsSourceToserverBaseUrl()
            {
                const string ServerBaseUrl = "https://example.com";

                var stuntmanServerResponse = new StuntmanServerResponse
                {
                    Users = new[]
                    {
                        new StuntmanUser("user-1", "User 1")
                    }
                };

                var json = JsonConvert.SerializeObject(stuntmanServerResponse);

                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                    webClientStringToReturn: json));

                options.TryAddConfigurationFromServer(ServerBaseUrl);

                Assert.Equal(ServerBaseUrl, options.Users.Single().Source);
            }
Esempio n. 7
0
            public void ProcessesStuntmanServerResponse()
            {
                const string Id1 = "user-1";

                var stuntmanServerResponse = new StuntmanServerResponse
                {
                    Users = new[]
                    {
                        new StuntmanUser(Id1, "User 1")
                    }
                };

                var json = JsonConvert.SerializeObject(stuntmanServerResponse);

                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                    webClientStringToReturn: json));

                options.TryAddConfigurationFromServer("https://example.com");

                Assert.Equal(Id1, options.Users.Single().Id);
            }
Esempio n. 8
0
            public void DoesNotThrowForUnexpectedResponse()
            {
                var options = new StuntmanOptions(stuntmanOptionsRetriever: new TestStuntmanOptionsRetriever(
                    webClientStringToReturn: "some_error"));

                options.TryAddConfigurationFromServer("https://example.com");
            }