public void ShouldGetOrganisation() { // Arrange var contentfulOrganisation = new ContentfulOrganisation() { AboutUs = "about us", Email = "Email", Phone = "Phone", Slug = "slug", Title = "title", Volunteering = true, VolunteeringText = "test" }; var builder = new QueryBuilder <ContentfulOrganisation>().ContentTypeIs("organisation").FieldEquals("fields.slug", "slug"); var contentfulCollection = new ContentfulCollection <ContentfulOrganisation>() { Items = new List <ContentfulOrganisation> { contentfulOrganisation } }; _contentfulClient.Setup(o => o.GetEntries(It.Is <QueryBuilder <ContentfulOrganisation> >(q => q.Build() == builder.Build()), It.IsAny <CancellationToken>())) .ReturnsAsync(contentfulCollection); // Act var response = AsyncTestHelper.Resolve(_repository.GetOrganisation("slug")); var organisation = response.Get <Organisation>(); // Assert response.StatusCode.Should().Be(HttpStatusCode.OK); organisation.Slug.Should().Be(contentfulOrganisation.Slug); }
public OrganisationContentfulFactoryTest() { _contentfulOrganisationFactory = new Mock <IContentfulFactory <ContentfulOrganisation, Organisation> >(); _contentfulOrganisation = new ContentfulOrganisation { AboutUs = "about us", Email = "email", Image = null, Phone = "phone", Slug = "slug", Title = "title", Volunteering = true, VolunteeringText = "help wanted" }; _organisationContentfulFactory = new OrganisationContentfulFactory(); }