public void GetTestShouldPass() { var harness = new ControllerTestHarness(); var collection = harness.Fixture.CreateMany<Contact>().ToList(); var response = harness.Fixture.Build<CollectionResponse<Contact>>() .With(r => r.Errors, new List<string>()) .With(r => r.Collection, collection) .Create(); harness.SetupGetContacts(response); var controller = harness.GetContactsController(); var result = controller.Get(String.Empty); result.Should().NotBeNull(); result.Should().BeAssignableTo<IEnumerable<Contact>>(); }
public void GetTestShouldPass() { var harness = new ControllerTestHarness(); var collection = harness.Fixture.CreateMany <Contact>().ToList(); var response = harness.Fixture.Build <CollectionResponse <Contact> >() .With(r => r.Errors, new List <string>()) .With(r => r.Collection, collection) .Create(); harness.SetupGetContacts(response); var controller = harness.GetContactsController(); var result = controller.Get(String.Empty); result.Should().NotBeNull(); result.Should().BeAssignableTo <IEnumerable <Contact> >(); }
public void GetTestShouldFail() { var harness = new ControllerTestHarness(); var collection = harness.Fixture.CreateMany<Contact>().ToList(); var response = harness.Fixture.Build<CollectionResponse<Contact>>() .With(r => r.Errors, harness.Fixture.CreateMany<String>(1).ToList()) .Create(); harness.SetupGetContacts(response); var controller = harness.GetContactsController(); try { var result = controller.Get(String.Empty); } catch (HttpException ex) { ex.GetHttpCode().Should().Be(500); } }
public void GetTestShouldFail() { var harness = new ControllerTestHarness(); var collection = harness.Fixture.CreateMany <Contact>().ToList(); var response = harness.Fixture.Build <CollectionResponse <Contact> >() .With(r => r.Errors, harness.Fixture.CreateMany <String>(1).ToList()) .Create(); harness.SetupGetContacts(response); var controller = harness.GetContactsController(); try { var result = controller.Get(String.Empty); } catch (HttpException ex) { ex.GetHttpCode().Should().Be(500); } }