public void AttachShouldFailOnNullBuilder() { var testContext = new TestClientContext { GetMetadataBuilderFunc = (set, e) => null }; Action action = () => testContext.AttachTo("FakeSet", new SingleKeyType { Property = "foo" }); action.ShouldThrow<InvalidOperationException>().WithMessage(Strings.Context_EntityMetadataBuilderIsRequired); }
public void AttachShouldFailOnNullBuilder() { var testContext = new TestClientContext { GetMetadataBuilderFunc = (set, e) => null }; Action action = () => testContext.AttachTo("FakeSet", new SingleKeyType { Property = "foo" }); action.ShouldThrow <InvalidOperationException>().WithMessage(Strings.Context_EntityMetadataBuilderIsRequired); }
public void AttachShouldUseBuilder() { const string fakeEditLink = "http://thisIsTheEditLink.org/"; const string fakeId = "http://thisIsTheId.org/"; var simulator = new EntityMetadataBuilderSimulator { GetEditLinkFunc = () => new Uri(fakeEditLink), GetIdFunc = () => new Uri(fakeId), }; var testContext = new TestClientContext(new Uri("http://temp.org/")) { GetMetadataBuilderFunc = (set, e) => simulator }; testContext.AttachTo("FakeSet", new SingleKeyType { Property = "foo" }); EntityDescriptor entityDescriptor = testContext.Entities[0]; entityDescriptor.EditLink.Should().Be(fakeEditLink); entityDescriptor.Identity.Should().Be(fakeId); }
public void AttachShouldUseBuilder() { const string fakeEditLink = "http://thisIsTheEditLink.org/"; const string fakeId = "http://thisIsTheId.org/"; var simulator = new EntityMetadataBuilderSimulator { GetEditLinkFunc = () => new Uri(fakeEditLink), GetIdFunc = () => new Uri(fakeId), }; var testContext = new TestClientContext(new Uri("http://temp.org/")) { GetMetadataBuilderFunc = (set, e) => simulator }; testContext.AttachTo("FakeSet", new SingleKeyType { Property = "foo" }); EntityDescriptor entityDescriptor = testContext.Entities[0]; entityDescriptor.EditLink.Should().Be(fakeEditLink); entityDescriptor.Identity.Should().Be(fakeId); }