コード例 #1
0
        public void you_can_delete_a_design()
        {
            var theLastDesign = ExampleProduct.Designs[0];
            var addNewDesign = new DesignRepository(Internet, Settings.BaseUrl);

            ExampleProduct = addNewDesign.Add(ExampleProduct.Key, NewDesign());

            Assert.AreEqual(2, ExampleProduct.Designs.Count,
                "Invalid test data" +
                "In order for this test to be valid, the product needs to have " +
                "more than one design (since you can't delete the last one)"
            );

            var command = new DesignRepository(Internet, Settings.BaseUrl);

            var theRefreshedProduct = command.Delete(ExampleProduct.Key, ExampleProduct.Designs[1].Key);

            Assert.AreEqual(1, theRefreshedProduct.Designs.Count, "Expected the design to have been deleted");
            Assert.AreEqual(theLastDesign.Key, theRefreshedProduct.Designs[0].Key, "Expected that the newly-added one was deleted");
        }
コード例 #2
0
        public void you_can_add_a_new_design()
        {
            var theInitialDesignCount = ExampleProduct.Designs.Count;

            var command = new DesignRepository(Internet, Settings.BaseUrl);
            var theNewDesign = NewDesign();

            var result = command.Add(ExampleProduct.Key, theNewDesign);

            Assert.AreEqual(theInitialDesignCount + 1, result.Designs.Count, "Expected the new design to have been added");
        }