Ejemplo n.º 1
0
        public void Should_be_able_to_load_model_when_Session_is_not_null()
        {
            _httpContext.Stub(x => x.Session).Return(_sessionState);
            _sessionState.Expect(c => c[RequestDataProvider.REQUESTDATA_PREFIX_KEY + "Property1"]).Return(
                _flashViewModelForTesting.Property1);
            _sessionState.Expect(c => c[RequestDataProvider.REQUESTDATA_PREFIX_KEY + "Property2"]).Return(
                _flashViewModelForTesting.Property2);
            _sessionState.Expect(c => c[RequestDataProvider.REQUESTDATA_PREFIX_KEY + "Property3"]).Return(
                _flashViewModelForTesting.Property3);

            var testing = new RequestDataProvider(_httpContext).Load <FlashViewModelForTesting>();

            _httpContext.VerifyAllExpectations();
            _sessionState.VerifyAllExpectations();

            testing.Property1.ShouldEqual(_flashViewModelForTesting.Property1);
            testing.Property2.ShouldEqual(_flashViewModelForTesting.Property2);
            testing.Property3.ShouldEqual(_flashViewModelForTesting.Property3);
        }