Exemple #1
0
            public void ShouldReturnTheBuilder(ScriptServicesBuilder builder)
            {
                var someValue       = new SomeOverride();
                var returnedBuilder = builder.SetOverride <ISomeOverride, SomeOverride>(someValue);

                returnedBuilder.ShouldBeSameAs(builder);
            }
Exemple #2
0
            public void ShouldSetTheValueUsingTheKey(ScriptServicesBuilder builder)
            {
                var someValue = new SomeOverride();
                var key       = typeof(ISomeOverride);

                builder.SetOverride <ISomeOverride, SomeOverride>(someValue);

                var overrides = builder.Overrides;

                overrides.ContainsKey(key).ShouldBeTrue();
                overrides[key].ShouldBeSameAs(someValue);
            }
Exemple #3
0
            public void ShouldReplaceTheValueWhenKeyAlreadyExists(ScriptServicesBuilder builder)
            {
                var key         = typeof(ISomeOverride);
                var firstValue  = new SomeOverride();
                var secondValue = new SomeOverride();

                builder.SetOverride <ISomeOverride, SomeOverride>(firstValue);
                builder.SetOverride <ISomeOverride, SomeOverride>(secondValue);

                var overrides = builder.Overrides;

                overrides[key].ShouldNotBeSameAs(firstValue);
                overrides[key].ShouldBeSameAs(secondValue);
            }
            public void ShouldReplaceTheValueWhenKeyAlreadyExists(ScriptServicesBuilder builder)
            {
                var key = typeof(ISomeOverride);
                var firstValue = new SomeOverride();
                var secondValue = new SomeOverride();

                builder.SetOverride<ISomeOverride, SomeOverride>(firstValue);
                builder.SetOverride<ISomeOverride, SomeOverride>(secondValue);

                var overrides = builder.Overrides;
                overrides[key].ShouldNotBeSameAs(firstValue);
                overrides[key].ShouldBeSameAs(secondValue);
            }
            public void ShouldSetTheValueUsingTheKey(ScriptServicesBuilder builder)
            {
                var someValue = new SomeOverride();
                var key = typeof(ISomeOverride);
                builder.SetOverride<ISomeOverride, SomeOverride>(someValue);

                var overrides = builder.Overrides;
                overrides.ContainsKey(key).ShouldBeTrue();
                overrides[key].ShouldBeSameAs(someValue);
            }
            public void ShouldReturnTheBuilder(ScriptServicesBuilder builder)
            {
                var someValue = new SomeOverride();
                var returnedBuilder = builder.SetOverride<ISomeOverride, SomeOverride>(someValue);

                returnedBuilder.ShouldBeSameAs(builder);
            }