Пример #1
0
        public void GetStubForKey_AddedStubForTheKeyTwice_ReturnsLastStubbedValue()
        {
            const int stubValue1 = 11;
            const int stubValue2 = 111;
            var       stub       = new StubBuilder();

            stub.Value(For.GameId).Is(stubValue1);
            stub.Value(For.GameId).Is(stubValue2);

            Assert.That(stub.Get <int>(For.GameId), Is.EqualTo(stubValue2));
        }
Пример #2
0
        public void OutForKey2_AddedTwoStubForDifferentKeys_ReturnsStubbedValueForKey2()
        {
            const int    stubValue1 = 11;
            const double stubValue2 = 111.0;
            var          stub       = new StubBuilder();

            stub.Value(For.GameId).Is(stubValue1);
            stub.Value(For.SB).Is(stubValue2);

            Assert.That(stub.Out <double>(For.SB), Is.EqualTo(stubValue2));
        }
Пример #3
0
        public void OutForKey_AddedStubForTheKey_ReturnsStubbedValue()
        {
            const int stubValue = 11;
            var       stub      = new StubBuilder();

            stub.Value(For.GameId).Is(stubValue);

            Assert.That(stub.Out <int>(For.GameId), Is.EqualTo(stubValue));
        }
Пример #4
0
        public void GetStubForKey_TargetTypeNotEqualStubbedType_ThrowsArgumentException()
        {
            const int stubValue = 11;
            var       stub      = new StubBuilder();

            stub.Value(For.GameId).Is(stubValue);

            TestDelegate invokeGetStub = () => stub.Get <double>(For.GameId);

            Assert.Throws <ArgumentException>(invokeGetStub);
        }