コード例 #1
0
        public void Setup() => Schedule(() =>
        {
            BeatDivisor.Value = 8;
            Clock.Seek(0);

            Child = composer = new TestComposer {
                RelativeSizeAxes = Axes.Both
            };
        });
コード例 #2
0
        public void WhenExecuted_ShouldYield_DefaultSubstitutableClockFlow()
        {
            var passedFlow = default(IClockFlow);

            TestComposer
            .Prepare(flow => passedFlow = flow)
            .Execute();

            Assert.NotNull(passedFlow);
            Assert.Same(passedFlow, SubstitutableClockFlow.Default);
        }
コード例 #3
0
        public void WhenExecuted_ShouldCall_PrepareFactory()
        {
            const string methodName = nameof(TestComposer.IExecutable <object> .Execute);

            var called = false;

            object SampleFactory(IClockFlow _)
            {
                called = true;
                return(new object());
            }

            var preparedExecutable = TestComposer
                                     .Prepare(SampleFactory);

            Assert.False(called, $"Expecting to not call given Factory before '{methodName}'.");

            preparedExecutable
            .Execute();

            Assert.True(called, $"Expecting to call given Factory after '{methodName}'.");
        }
コード例 #4
0
        public void WhenExecuted_ShouldYield_PreparedInitialClockFlow()
        {
            // TODO: Make this values more unique:
            var instance     = DateTimeOffset.Now;
            var currentClick = DateTime.UtcNow;
            var config       = TimeZoneInfo.Local;

            var preparable = TestComposer
                             .WithInitial(instance)
                             .WithInitial(currentClick)
                             .WithInitial(config);

            var passedFlow = default(IClockFlow);

            preparable
            .Prepare(flow => passedFlow = flow)
            .Execute();

            Assert.NotNull(passedFlow);
            Assert.Equal(instance, passedFlow.Instance);
            Assert.Equal(currentClick, passedFlow.CurrentClick);
            Assert.Equal(config, passedFlow.Config);
        }