public void WHEN_Passing_Valid_Parameters_SHOULD_Succeed()
        {
            // Arrange
            ICookieAccessor <ComposerCookieDto> accessor = _container.CreateInstance <ComposerCookieAccessor>();

            // Act
            ComposerCookieDto dto = accessor.Read();

            // Assert
            dto.Should().NotBeNull();
        }
        public TestInventoryLocationProvider(
            IFulfillmentLocationsRepository fulfillmentLocationsRepository,
            IInventoryRepository inventoryRepository,
            ICookieAccessor <TestCookieDto> testCookieAccessor,
            IWebsiteContext websiteContext,
            ISiteConfiguration siteConfiguration)

            : base(
                fulfillmentLocationsRepository,
                inventoryRepository,
                websiteContext,
                siteConfiguration)
        {
            _testCookieAccessor = testCookieAccessor;
        }
Beispiel #3
0
        public void WHEN_Passing_Valid_Parameters_SHOULD_Succeed(string customerIdGuid, bool?isGuest)
        {
            // Arrange
            ICookieAccessor <ComposerCookieDto> accessor = _container.CreateInstance <ComposerCookieAccessor>();
            Guid?customerId = customerIdGuid != null ? new Guid(customerIdGuid) : (Guid?)null;

            // Act
            ComposerCookieDto dto = accessor.Read();

            dto.EncryptedCustomerId = new EncryptionUtility().Encrypt(customerId.ToString());
            dto.IsGuest             = isGuest;
            accessor.Write(dto);

            // Assert
            _container.Get <HttpResponseBase>().Cookies.Count.Should().BeGreaterThan(0);
        }
        public ComposerContext(
            ICookieAccessor <ComposerCookieDto> cookieAccessor,
            IScopeProvider scopeProvider,
            HttpContextBase httpContextBase,
            ICountryCodeProvider countryCodeProvider,
            IWebsiteContext websiteContext)
        {
            CookieAccessor      = cookieAccessor ?? throw new ArgumentNullException(nameof(cookieAccessor));
            ScopeProvider       = scopeProvider ?? throw new ArgumentNullException(nameof(scopeProvider));
            HttpContextBase     = httpContextBase ?? throw new ArgumentNullException(nameof(httpContextBase));
            CountryCodeProvider = countryCodeProvider ?? throw new ArgumentNullException(nameof(countryCodeProvider));
            WebsiteContext      = websiteContext ?? throw new ArgumentNullException(nameof(websiteContext));
            EncryptionUtility   = new EncryptionUtility();

            SetAuthenticated();
        }
Beispiel #5
0
        private bool IsGuest(ICookieAccessor <ComposerCookieDto> cookieAccessor)
        {
            var dto = cookieAccessor.Read();

            return(dto.IsGuest.GetValueOrDefault(true));
        }