Пример #1
0
 protected override void ScenarioSetup()
 {
     base.ScenarioSetup();
     ExpectedStatements = new[] { new Statement(ExpectedSubject, new Iri("predicate"), String.Empty) };
     StreamReader       = new StreamReader(new MemoryStream());
     RdfReader          = new Mock <IRdfReader>(MockBehavior.Strict);
     RdfReader.Setup(instance => instance.Read(It.IsAny <StreamReader>()))
     .ReturnsAsync(new Dictionary <Iri, IEnumerable <Statement> >()
     {
         { new Iri("graph"), ExpectedStatements }
     });
     Context.Setup(instance => instance.Clear());
     Context.Setup(instance => instance.CreateInternal(It.IsAny <Iri>(), It.IsAny <bool>()))
     .Returns <Iri, bool>((iri, initialize) => (Entity)EntitySource.Create(iri));
     Context.Setup(instance => instance.InitializeInternal(
                       It.IsAny <Entity>(),
                       It.IsAny <IEnumerable <Statement> >(),
                       It.IsAny <EntityInitializationContext>(),
                       It.IsAny <Action <Statement> >()))
     .Callback <Entity, IEnumerable <Statement>, EntityInitializationContext, Action <Statement> >(
         (entity, statements, context, handler) => statements.ToList().ForEach(handler));
 }
 public void Should_create_new_entity_only_once()
 {
     EntitySource.Create <IProduct>(new Iri("test")).Should().Be(Result);
 }
 public override void TheTest()
 {
     Result = EntitySource.Create <IProduct>(new Iri("test"));
 }