public void GetCurrencyCodeWillReturnDefaultCurrencyCodeWhenProfileIsNotUserProfile()
        {
            // Fixture setup
            var profile = new Mock <ProfileBase>().Object;

            var httpContextStub = new Mock <HttpContextBase>();

            httpContextStub.SetupGet(ctx => ctx.Profile).Returns(profile);

            var sut = new DefaultCurrencyProfileService(httpContextStub.Object);
            // Exercise system
            var result = sut.GetCurrencyCode();

            // Verify outcome
            Assert.Equal <string>("DKK", result);
            // Teardown
        }
        public void GetCurrencyCodeWillReturnDefaultCurrencyCodeWhenUserProfileCurrencyIsNull()
        {
            // Fixture setup
            var userProfileStub = new Mock <UserProfile>();

            userProfileStub.SetupGet(up => up.Currency).Returns((string)null);

            var httpContextStub = new Mock <HttpContextBase>();

            httpContextStub.SetupGet(ctx => ctx.Profile).Returns(userProfileStub.Object);

            var sut = new DefaultCurrencyProfileService(httpContextStub.Object);
            // Exercise system
            var result = sut.GetCurrencyCode();

            // Verify outcome
            Assert.Equal <string>("DKK", result);
            // Teardown
        }
        public void GetCurrencyCodeWillReturnProfileFromContextWhenThatProfileIsUserProfile()
        {
            // Fixture setup
            var fixture = new ControllerFixture();
            var expectedCurrencyCode = fixture.CreateAnonymous("CurrencyCode");

            var userProfileStub = new Mock <UserProfile>();

            userProfileStub.SetupGet(up => up.Currency).Returns(expectedCurrencyCode);

            var httpContextStub = new Mock <HttpContextBase>();

            httpContextStub.SetupGet(ctx => ctx.Profile).Returns(userProfileStub.Object);

            var sut = new DefaultCurrencyProfileService(httpContextStub.Object);
            // Exercise system
            var result = sut.GetCurrencyCode();

            // Verify outcome
            Assert.Equal <string>(expectedCurrencyCode, result);
            // Teardown
        }