コード例 #1
0
        public void ConstructorSetsCorrectInitializedMembers2()
        {
            var fixture  = new Fixture();
            var expected = new object[] { fixture.Create <string>(), fixture.Create <int>() };

            var sut = new ExceptionBehaviorExpectation <ArgumentException>(
                new Mock <ISpecimenBuilder>().Object,
                fixture.Create <string>(),
                expected);

            Assert.Equal(expected, sut.Values);
        }
コード例 #2
0
        public void VerifyWithCommandThatHasNoMethodInvokeCommandDoesNotThrow()
        {
            var fixture                             = new Fixture();
            var specimenBuilderMock                 = new Mock <ISpecimenBuilder>();
            var guardClauseExtensionsMock           = new Mock <IGuardClauseExtensions>();
            MethodInvokeCommand methodInvokeCommand = null;

            guardClauseExtensionsMock
            .Setup(e => e.TryGetMethodInvokeCommand(
                       It.IsAny <IGuardClauseCommand>(),
                       out methodInvokeCommand))
            .Returns(false);
            var sut = new ExceptionBehaviorExpectation <InvalidOperationException>(
                specimenBuilderMock.Object,
                guardClauseExtensionsMock.Object,
                fixture.Create <string>(),
                fixture.Create <Guid>());

            var ex = Record.Exception(() => sut.Verify(new Mock <IGuardClauseCommand>().Object));

            Assert.Null(ex);
        }