public void GetStubForKey_DidNotAddStubForTheKey_ThrowsKeyNotFoundException() { var stub = new StubBuilder(); TestDelegate invokeGetStub = () => stub.Get <double>(For.GameId); Assert.Throws <KeyNotFoundException>(invokeGetStub); }
public void Out_SetupGetForId_StubsId() { const int stubbedValue = 2; var foo = new StubBuilder() .Setup <IFoo>().Get(f => f.Id).Returns(stubbedValue).Out; Assert.That(foo.Id, Is.EqualTo(stubbedValue)); }
public void GetStubForKey_AddedStubForTheKey_ReturnsStubbedValue() { const int stubValue = 11; var stub = new StubBuilder(); stub.Value(For.GameId).Is(stubValue); Assert.That(stub.Get <int>(For.GameId), Is.EqualTo(stubValue)); }
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)); }
public void OutForKey_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.Out <int>(For.GameId), Is.EqualTo(stubValue2)); }
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); }
public void Out_SetupGetForIdAndName_StubsId() { const int stubbedInt = 2; const string stubbedString = "string"; var foo = new StubBuilder() .Setup <IFoo>().Get(f => f.Id).Returns(stubbedInt) .Get(f => f.Name).Returns(stubbedString) .Out; Assert.That(foo.Id, Is.EqualTo(stubbedInt)); }
public void OutForKey_DidNotAddStubForTheKey_ReturnsDefaultValue() { var stub = new StubBuilder(); Assert.That(stub.Out <int>(For.GameId), Is.EqualTo(default(int))); }
public void Out_Interface_ObjectOfTypeInterface() { var foo = new StubBuilder().Out <IFoo>(); Assert.That(foo, Is.Not.Null); }
internal ValueSetup(StubBuilder builder, IDictionary <For, ValueInfo> stubValues, For keyToDefine) { _builder = builder; _stubValues = stubValues; _keyToDefine = keyToDefine; }