Exemple #1
0
        public Something([NotNull] ISomethingElse something)
        {
            Guard.ArgumentNotNull(something,
                                  nameof(something));

            SomethingElse = something;
            Name          = "SomethingElse.Name";
        }
Exemple #2
0
 public Player(IUserArmor armor, IMessenger messenger, ISomethingElse somethingElse)
 {
     this.armor = armor;
     this.messenger = messenger;
     this.somethingElse = somethingElse;
     this.HitPoints = 100;
     this.Alive = true;
     this.Rage = 0;
 }
Exemple #3
0
        public void DefaultConvention_MostUsualTypes_Registered()
        {
            var container = new Container(cfg => cfg
                                          .Scan(scanner =>
            {
                scanner.AssemblyContainingType <AutoWiringTester>();
                scanner.WithDefaultConventions();
            }));

            ISomething something = container.TryGetInstance <ISomething>();

            // not null since it conforms to default convention
            Assert.That(something, Is.InstanceOf <Something>());

            ISomethingElse somethingElse = container.TryGetInstance <ISomethingElse>();

            // null since "NotSomethingElse" is not converered by the default convention
            Assert.That(somethingElse, Is.Null);
        }
        public void Invoked_ForLazySutAndNullTest_ReturnsInstance(
            Lazy <Something> sut,
            [BeNull] ISomethingElse _)
        {
            using (new AssertionScope( ))
            {
                sut.Should( )
                .NotBeNull( );

                sut.IsValueCreated
                .Should( )
                .BeFalse( );

                Action action = () =>
                {
                    // ReSharper disable once UnusedVariable
                    var actual = sut.Value;
                };

                action.Should( )
                .Throw <ArgumentNullException> ( )
                .WithParameter("something");
            }
        }
Exemple #5
0
 public SomethingUnderTest(ISomethingElse somethingElse)
 {
     _somethingElse = somethingElse;
 }
Exemple #6
0
 protected override void Given()
 {
     _result = "bar";
     _fake   = Fixture.Freeze <ISomethingElse>();
     _fake.Expect(x => x.SayHello()).Return("hi");
 }