Ejemplo n.º 1
0
        public void BadIdeaUnitTest()
        {
            using (ShimsContext.Create())
            {
                SetupBadIdeaHttpShims();

                var badIdeaClass = new BadIdea();
                var result = badIdeaClass.GetNewBadIdea();
                Assert.IsInstanceOfType(result, typeof (string));
            }
        }
Ejemplo n.º 2
0
        public void GetBadIdeaExceptionTest()
        {
            using (ShimsContext.Create())
            {
                ShimHttpClient.AllInstances.GetAsyncString = (client, s) =>
                    {
                        var httpResponseMessage = new HttpResponseMessage(HttpStatusCode.BadRequest);
                        var task = Task.FromResult(httpResponseMessage);
                        return task;
                    };

                var badIdeaClass = new BadIdea();
                var result = badIdeaClass.GetNewBadIdea();
                Assert.IsInstanceOfType(result, typeof(string));
            }
        }