예제 #1
0
        private void test()
        {
            var vendors = vendorService.SearchVendors("Fedco");

            if (vendors.Result.Count == 0)
            {
                Logger.Info("Creating");
                Vendor vendor = new Vendor()
                {
                    Name           = "Fedco Seeds",
                    Phone          = "207-426-9900",
                    Email          = "",
                    WebSite        = "http://www.fedcoseeds.com",
                    ProductBaseUrl = "http://www.fedcoseeds.com/seeds/search.php?item="
                };
                vendorService.CreateVendor(vendor);
            }
            else
            {
                Logger.Info("Exists");
                var vendor = vendors.Result.First();
                vendor.WebSite = "www.fedcoseeds.com";

                vendorService.UpdateVendor(vendor);
            }
        }
예제 #2
0
        public void CreateVendor_Returns_New_Id_When_Created()
        {
            // Arrange
            int id     = int.MaxValue;
            var vendor = new Vendor
            {
                VendorID    = 5,
                VendorName  = "DADADA",
                VendorPhone = "7776665544",
                Email       = "*****@*****.**"
            };

            mockRepository.Setup(m => m.CreateVendor(vendor)).Returns(id);

            // Act
            id = service.CreateVendor(vendor);

            // Asserts
            Assert.NotNull(vendor);
            Assert.Equal(5, vendor.VendorID);
        }