Exemple #1
0
        public void MapPriceTest07()
        {
            // Arrange
            var product = new ProductItem
            {
                VatRate     = 1.25m,
                PriceListId = null,
                Price       = 100
            };

            var stormContext = MockRepository.GenerateMock <IStormContext>();

            stormContext.Stub(x => x.Configuration).Return(new StormConfigurationSection());
            stormContext.Stub(x => x.ShowPricesIncVat).Return(false);
            StormContext.SetInstance(stormContext);

            // Act
            var result = MockBuilderBase.MapPrice(product);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1.25m, result.VatRate);
            Assert.AreEqual(0, result.PricelistId);
            Assert.AreEqual(100, result.Display);
            Assert.AreEqual(100, result.Catalog);
            Assert.AreEqual(100, result.Recommended);
        }
Exemple #2
0
        public void GetImageUrlTest01()
        {
            var imageKey = Guid.Empty;
            var result   = MockBuilderBase.GetImageUrl(imageKey);

            Assert.AreEqual("http://services.enferno.se/image/00000000-0000-0000-0000-000000000000.jpg", result);
        }
Exemple #3
0
        public void MapFlagsTest01()
        {
            // Arrange
            var flagList = new List <int>();

            // Act
            MockBuilderBase.MapFlags(null, flagList);

            // Assert
            Assert.AreEqual(0, flagList.Count);
        }
Exemple #4
0
        public void MapFlagsTest03()
        {
            // Arrange
            const string flagSeed = "1,2,2,5";
            var          flagList = new List <int>();

            // Act
            MockBuilderBase.MapFlags(flagSeed, flagList);

            // Assert
            Assert.AreEqual(3, flagList.Count);
        }
Exemple #5
0
        public void MapProductManufacturerTest01()
        {
            // Arrange
            var manufacturer = new ProductManufacturer
            {
                Id   = 1,
                Name = "Bob"
            };

            // Act
            var result = MockBuilderBase.MapProductManufacturer(manufacturer);

            // Assert
            Assert.AreEqual(1, result.Id);
            Assert.AreEqual("Bob", result.Name);
            Assert.AreEqual(null, result.ImageUrl);
        }
Exemple #6
0
        public void MapProductManufacturerTest02()
        {
            // Arrange
            var manufacturer = new ProductManufacturer
            {
                Id      = 1,
                Name    = "Bob",
                LogoKey = Guid.Empty
            };

            // Act
            var result = MockBuilderBase.MapProductManufacturer(manufacturer);

            // Assert
            Assert.AreEqual(1, result.Id);
            Assert.AreEqual("Bob", result.Name);
            Assert.AreEqual("http://services.enferno.se/image/00000000-0000-0000-0000-000000000000.jpg", result.ImageUrl);
        }