public async Task TestUpdateOneFlowerShopHappyPath()
        {
            var shop = new FlowerShop()
            {
                id          = 1,
                shopName    = "testshopname 1",
                streetName  = "teststreetname 1",
                houseNumber = "testhousenumber 1",
                city        = "testcity 1",
                postalCode  = "testpostalcode 1",
                phoneNumber = "testphonenumber 1",
                email       = "testemail 1"
            };

            _flowerShopRepoMock.Setup(x => x.Update(1, "testshopname 1", "teststreetname 1", "testhousenumber 1", "testcity 1", "testpostalcode 1", "testphonenumber 1", "testemail 1")).Returns(Task.FromResult(shop)).Verifiable();
            var shopResponse = await _flowerShopController.UpdateFlowerShop(1, new FlowerShopUpsertInput()
            {
                shopName    = "testshopname 1",
                streetName  = "teststreetname 1",
                houseNumber = "testhousenumber 1",
                city        = "testcity 1",
                postalCode  = "testpostalcode 1",
                phoneNumber = "testphonenumber 1",
                email       = "testemail 1"
            });

            shopResponse.Should().BeOfType <AcceptedResult>();
            Snapshot.Match(shopResponse);
        }
示例#2
0
        static void Main(string[] args)
        {
            List <Florist> florists = new List <Florist>()
            {
                new Florist("Vanya"), new Florist("Fedya")
            };
            Dictionary <Flower, int> flowers = new Dictionary <Flower, int>
            {
                [new Flower("Tulip", 30, 40)]         = 35,
                [new Flower("Rose", 50, 60)]          = 40,
                [new Flower("Chrysanthemum", 40, 15)] = 100,
                [new Flower("Chamomile", 20, 10)]     = 20,
            };

            FlowerShop flowerShop = new FlowerShop(florists, flowers);

            flowerShop.Florists[0].CreateBunch(new HappyBirthdayBunchBuilder());
            flowerShop.Florists[1].CreateBunch(new WeddingBunchBuilder());

            flowerShop.Florists[0].CreateBunch(new CustomBunchBuilder(new Dictionary <Flower, int> {
                [new Flower("Chrysanthemum", 40, 15)] = 15
            }, new Ribbon("CustomRibbon1"), new Wrap("CustomWrap1")));
            flowerShop.Florists[1].CreateBunch(new CustomBunchBuilder(new Dictionary <Flower, int> {
                [new Flower("Carnation", 40, 15)] = 21
            }, new Ribbon("CustomRibbon2"), new Wrap("CustomWrap2")));
        }
        private void AddTreeMethod(object sender, RoutedEventArgs e)
        {
            float height  = CheckString(TreeHeight.Text);
            float price   = CheckString(TreePrice.Text);
            Tree  newTree = new Tree(price, height);

            DataContext = FlowerShop.AddStock(newTree);
            NavigationService.GoBack();
        }
示例#4
0
        private void AddFlowerMethod(object sender, RoutedEventArgs e)
        {
            string color     = checkColorName(FlowerColor.Text);
            float  price     = CheckString(FlowerPrice.Text);
            Flower newFlower = new Flower(price, color);

            DataContext = FlowerShop.AddStock(newFlower);
            NavigationService.GoBack();
        }
        private void AddDecorationMethod(object sender, RoutedEventArgs e)
        {
            string     material      = DecorationMaterial.Text;
            float      price         = CheckString(DecorationPrice.Text);
            Decoration newDecoration = new Decoration(price, material);

            DataContext = FlowerShop.AddStock(newDecoration);
            NavigationService.GoBack();
        }
        public async Task <FlowerShop> Insert(string ShopName, string StreetName, string HouseNumber, string City, string PostalCode, string PhoneNumber, string Email)
        {
            var shop = new FlowerShop
            {
                shopName    = ShopName,
                streetName  = StreetName,
                houseNumber = HouseNumber,
                city        = City,
                postalCode  = PostalCode,
                phoneNumber = PhoneNumber,
                email       = Email
            };

            await _context.FlowerShop.AddAsync(shop);

            await _context.SaveChangesAsync();

            return(shop);
        }
        public async Task TestGetOnFlowerShopHappyPath()
        {
            var shop = new FlowerShop()
            {
                id          = 1,
                shopName    = "testshopname 1",
                streetName  = "teststreetname 1",
                houseNumber = "testhousenumber 1",
                city        = "testcity 1",
                postalCode  = "testpostalcode 1",
                phoneNumber = "testphonenumber 1",
                email       = "testemail 1"
            };

            _flowerShopRepoMock.Setup(x => x.GetOneShopById(1)).Returns(Task.FromResult(shop)).Verifiable();
            var shopsResponse = await _flowerShopController.FlowerShopById(1);

            shopsResponse.Should().BeOfType <OkObjectResult>();
            Snapshot.Match(shopsResponse);
        }
 public AddTreePage()
 {
     InitializeComponent();
     DataContext = FlowerShop.GetDetails();
 }
示例#9
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = FlowerShop.GetDetails();
 }
示例#10
0
 public StockPage()
 {
     InitializeComponent();
     DataContext = FlowerShop.GenerateProductStocks();
 }
示例#11
0
 public FlowerShopName()
 {
     InitializeComponent();
     DataContext = FlowerShop.GetDetails();
 }
示例#12
0
 public static FlowerShopWebOutput Convert(this FlowerShop input)
 {
     return(new FlowerShopWebOutput(input.id, input.shopName, input.streetName, input.houseNumber, input.city, input.postalCode, input.phoneNumber, input.email));
 }
 public AddDecorationPage()
 {
     InitializeComponent();
     DataContext = FlowerShop.GetDetails();
 }