Esempio n. 1
0
        public void Report(
            IStateMachine<string, int> machine,
            IStateMachineReport<string, int> report)
        {
            "establish a state machine"._(() =>
                machine = new PassiveStateMachine<string, int>());

            "establish a state machine reporter"._(() =>
                report = A.Fake<IStateMachineReport<string, int>>());

            "when creating a report"._(() =>
                machine.Report(report));

            "it should call the passed reporter"._(() =>
                A.CallTo(() => report.Report(A<string>._, A<IEnumerable<IState<string, int>>>._, A<Initializable<string>>._)));
        }
Esempio n. 2
0
        public void Report(
            IStateMachine <string, int> machine,
            IStateMachineReport <string, int> report)
        {
            "establish a state machine".x(() =>
                                          machine = new PassiveStateMachine <string, int>());

            "establish a state machine reporter".x(() =>
                                                   report = A.Fake <IStateMachineReport <string, int> >());

            "when creating a report".x(() =>
                                       machine.Report(report));

            "it should call the passed reporter".x(() =>
                                                   A.CallTo(() => report.Report(A <string> ._, A <IEnumerable <IState <string, int> > > ._, A <Initializable <string> > ._)));
        }
Esempio n. 3
0
        public void Report(
            IAsyncStateMachine <string, int> machine,
            IStateMachineReport <string, int> report)
        {
            "establish a state machine".x(()
                                          => machine = new StateMachineDefinitionBuilder <string, int>()
                                                       .WithInitialState("initial")
                                                       .Build()
                                                       .CreatePassiveStateMachine());

            "establish a state machine reporter".x(()
                                                   => report = A.Fake <IStateMachineReport <string, int> >());

            "when creating a report".x(()
                                       => machine.Report(report));

            "it should call the passed reporter".x(()
                                                   => A.CallTo(() =>
                                                               report.Report(A <string> ._, A <IEnumerable <IStateDefinition <string, int> > > ._, A <string> ._))
                                                   .MustHaveHappened());
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a report with the specified generator.
        /// </summary>
        /// <param name="reportGenerator">The report generator.</param>
        public void Report(IStateMachineReport <TState, TEvent> reportGenerator)
        {
            Guard.AgainstNullArgument("reportGenerator", reportGenerator);

            reportGenerator.Report(this.ToString(), this.states.GetStates(), this.initialStateId);
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a report with the specified generator.
        /// </summary>
        /// <param name="reportGenerator">The report generator.</param>
        public void Report(IStateMachineReport <TState, TEvent> reportGenerator)
        {
            Ensure.ArgumentNotNull(reportGenerator, "reportGenerator");

            reportGenerator.Report(this.ToString(), this.states.GetStates(), this.initialStateId);
        }