示例#1
0
        public void For_ParameterlessCtor_ShouldNotHaveAnyDependencies()
        {
            // Act
            var result = Arrange.For <AccountRepository>(type => new object());

            // Assert
            result.Dependencies.Should().BeEmpty();
        }
示例#2
0
        public void For_MultipleCtorsFound_ShouldThrowInvalidOperationException()
        {
            // Act
            Action act = () => Arrange.For <MultipleCtor>(type => new object());

            // Assert
            act.Should().Throw <InvalidOperationException>();
        }
示例#3
0
        public void For_ConcreteType_ShouldBuild()
        {
            // Act
            var result = Arrange.For <AccountRepository>();

            // Assert
            Action verify = () => result.BuildSut();

            verify.Should().NotThrow();
        }
示例#4
0
        public void For_CtorWithParameters_ShouldReturnFluentArrangeObjectWithDependency()
        {
            // Arrange
            var dependency = new AccountRepository();

            // Act
            var result = Arrange.For <AccountService>(type => dependency);

            // Assert
            result.Dependencies.Values.Should().SatisfyRespectively(first => first.Should().Be(dependency));
        }