Beispiel #1
0
        public void SetAllAddsAllObjects()
        {
            var context = new BuildContext(new TestA(), new TestB());

            Assert.IsNotNull(context.Get <TestA>());
            Assert.IsNotNull(context.Get <TestB>());
        }
Beispiel #2
0
        public void CanSetAndRemove()
        {
            var context = new BuildContext();

            context.Set(new TestA());
            Assert.IsNotNull(context.Get <TestA>());
            context.Remove <TestA>();
            Assert.IsNull(context.Get <TestA>());
        }
Beispiel #3
0
        public void SetWithExistingType()
        {
            var context   = new BuildContext();
            var instance1 = new TestA();
            var instance2 = new TestA();

            context.Set(instance1);
            Assert.That(context.Get <TestA>(), Is.EqualTo(instance1));
            context.Set(instance2);
            Assert.That(context.Get <TestA>(), Is.EqualTo(instance2));
        }
        void ValidateTestContext(BuildContext context)
        {
            var results = context.Get <StepRunResults>();

            Assert.IsNotNull(results);
            Assert.That(results.stepsRan, Is.EqualTo(new[] { "step1", "step2" }));
        }
Beispiel #5
0
        public void CanSetContextWithObject()
        {
            var context = new BuildContext();

            context.Set(new TestA());
            Assert.IsNotNull(context.Get <TestA>());
        }
Beispiel #6
0
        public override BuildStepResult CleanupStep(BuildContext context)
        {
            var savedState = context.Get <PlayerSettingsState>();

            // Note: EditorJsonUtility.FromJsonOverwrite doesn't dirty PlayerSettings
            EditorJsonUtility.FromJsonOverwrite(savedState.Contents, PlayerSettingsState.Target);
            if (savedState.IsDirty)
            {
                EditorUtility.SetDirty(PlayerSettingsState.Target);
            }

            return(Success());
        }
        public void BuildSteps_CanChooseToNotRunCleanup_BasedOnRunResult()
        {
            var context = new BuildContext();

            context.Set(new TestBuildStep_RunSuccess_CleanupSuccess.Data {
                value = "success"
            });
            context.Set(new TestBuildStep_RunFailure_CleanupFailure.Data {
                value = "failure"
            });

            var pipeline = ScriptableObject.CreateInstance <BuildPipeline>();

            pipeline.AddSteps(typeof(TestBuildStep_RunSuccess_CleanupSuccess), typeof(TestBuildStep_RunFailure_CleanupFailure));

            LogAssert.Expect(LogType.Error, s_BuildFailureRegex);
            pipeline.RunSteps(context);

            var results = context.Get <StepCleanupResults>();

            Assert.That(results.stepsCleaned, Is.EqualTo(new[] { "success" }));
        }
Beispiel #8
0
        public void GetFailsWhenObjectNotPresent()
        {
            var context = new BuildContext();

            Assert.IsNull(context.Get <TestA>());
        }
Beispiel #9
0
        public void CanSetContextObjectWithConstructor()
        {
            var context = new BuildContext(new TestA());

            Assert.IsNotNull(context.Get <TestA>());
        }
 public override BuildStepResult RunStep(BuildContext context)
 {
     addedValue = context.Get <Data>().value;
     context.GetOrCreate <StepRunResults>().stepsRan.Add(addedValue);
     return(Success());
 }
 public override BuildStepResult RunStep(BuildContext context)
 {
     addedValue = context.Get <Data>().value;
     return(Failure("Step not ran."));
 }