示例#1
0
        public void BadIdeaUnitTest()
        {
            using (ShimsContext.Create())
            {
                SetupBadIdeaHttpShims();

                var badIdeaClass = new BadIdea();
                var result       = badIdeaClass.GetNewBadIdea();
                Assert.IsInstanceOfType(result, typeof(string));
            }
        }
示例#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));
            }
        }