public void GetTestShouldPass()
        {
            var harness = new ControllerTestHarness();

             var collection = harness.Fixture.CreateMany<Interaction>().ToList();
             var response = harness.Fixture.Build<CollectionResponse<Interaction>>()
            .With(r => r.Errors, new List<string>())
            .With(r => r.Collection, collection)
            .Create();
             harness.SetupGetInteractions(response);

             var controller = harness.GetInteractionsController();
             var result = controller.Get(String.Empty);
             result.Should().NotBeNull();
             result.Should().BeAssignableTo<IEnumerable<Interaction>>();
        }
예제 #2
0
        public void GetTestShouldPass()
        {
            var harness = new ControllerTestHarness();

            var collection = harness.Fixture.CreateMany <Interaction>().ToList();
            var response   = harness.Fixture.Build <CollectionResponse <Interaction> >()
                             .With(r => r.Errors, new List <string>())
                             .With(r => r.Collection, collection)
                             .Create();

            harness.SetupGetInteractions(response);

            var controller = harness.GetInteractionsController();
            var result     = controller.Get(String.Empty);

            result.Should().NotBeNull();
            result.Should().BeAssignableTo <IEnumerable <Interaction> >();
        }
        public void GetTestShouldFail()
        {
            var harness = new ControllerTestHarness();

             var collection = harness.Fixture.CreateMany<Interaction>().ToList();
             var response = harness.Fixture.Build<CollectionResponse<Interaction>>()
            .With(r => r.Errors, harness.Fixture.CreateMany<String>(1).ToList())
            .Create();
             harness.SetupGetInteractions(response);

             var controller = harness.GetInteractionsController();
             try
             {
            var result = controller.Get(String.Empty);
             }
             catch (HttpException ex)
             {
            ex.GetHttpCode().Should().Be(500);
             }
        }
예제 #4
0
        public void GetTestShouldFail()
        {
            var harness = new ControllerTestHarness();

            var collection = harness.Fixture.CreateMany <Interaction>().ToList();
            var response   = harness.Fixture.Build <CollectionResponse <Interaction> >()
                             .With(r => r.Errors, harness.Fixture.CreateMany <String>(1).ToList())
                             .Create();

            harness.SetupGetInteractions(response);

            var controller = harness.GetInteractionsController();

            try
            {
                var result = controller.Get(String.Empty);
            }
            catch (HttpException ex)
            {
                ex.GetHttpCode().Should().Be(500);
            }
        }