Пример #1
0
        /// <inheritdoc />
        public ThingContext Create(Thing thing, ThingOption option)
        {
            var thingType = thing.GetType();

            _response
            .SetThing(thing)
            .SetThingOption(option);

            _event
            .SetThing(thing)
            .SetThingOption(option)
            .SetThingType(thingType);

            _property
            .SetThing(thing)
            .SetThingOption(option);

            _action
            .SetThing(thing)
            .SetThingOption(option)
            .SetThingType(thingType);

            VisitEvent(thingType);
            VisitProperty(thingType);
            VisitAction(thingType);

            return(new ThingContext(
                       _response.Build(),
                       _event.Build(),
                       _action.Build(),
                       _property.Build()));
        }
Пример #2
0
        public ThingContextFactoryTest()
        {
            _response = Substitute.For <IThingResponseBuilder>();
            _event    = Substitute.For <IEventBuilder>();
            _property = Substitute.For <IPropertyBuilder>();
            _action   = Substitute.For <IActionBuilder>();

            _factory = new ThingContextFactory(_event, _property, _response, _action);

            _event
            .Build()
            .Returns(new Dictionary <string, EventCollection>());

            _response
            .Build()
            .Returns(new Dictionary <string, object>());

            _action
            .Build()
            .Returns(new Dictionary <string, ActionCollection>());

            _property
            .Build()
            .Returns(new Dictionary <string, IThingProperty>());
        }