コード例 #1
0
        public void you_must_supply_a_material_that_is_compatible_with_the_design()
        {
            const String INVALID_MATERIAL = "6812d5403269012e2f2f404062cdb04a";

            var designWithInvalidMaterial = new Design { Filename = "res\\bottom_new.stl", MaterialKey = INVALID_MATERIAL};

            var theError = Assert.Throws<Exception>(() => CreateCommand.Create(ProductSeed.WithName("xxx"), designWithInvalidMaterial));

            Assert.That(theError.Message, Is.StringMatching(
                "the material you have selected is not compatible with making methods available to the design file"
            ));
        }
コード例 #2
0
        private void AssertEqual(Design expected, Design actual)
        {
            Assert.AreEqual(Path.GetFileName(expected.Filename), actual.Filename);
            Assert.AreEqual(expected.Quantity, actual.Quantity);
            Assert.AreEqual(expected.Reference, actual.Reference);

            Assert.That(actual.MakeCost.Total, Is.GreaterThan(0D), "Unexpected total make cost");
            Assert.That(actual.MakeCost.Making, Is.GreaterThan(0D), "Unexpected making cost");
            Assert.That(actual.MakeCost.Materials, Is.GreaterThan(0D), "Unexpected material making cost");

            Assert.AreEqual("USD", actual.MakeCost.Currency	, "Unexpected currency");
        }
コード例 #3
0
        public void you_must_supply_a_material_that_is_available()
        {
            const String MATERIAL_THAT_DOES_NOT_EXIST = "1337";

            var designWithInvalidMaterial = new Design { Filename = "res\\bottom_new.stl", MaterialKey = MATERIAL_THAT_DOES_NOT_EXIST};

            var theError = Assert.Throws<Exception>(() => CreateCommand.Create(ProductSeed.WithName("xxx"), designWithInvalidMaterial));

            Assert.That(theError.Message, Is.StringMatching(
                "could not find requested material. is it available to this Node's material catalog?"
            ));
        }
コード例 #4
0
        public void you_must_supply_a_file_that_exists_on_disk_with_the_design()
        {
            var designWithoutAFile = new Design {Filename = "xxx_file_must_not_exist_on_disk_xxx"};

            var theError = Assert.Throws<FileNotFoundException>(() => CreateCommand.Create(ProductSeed.WithName("xxx"), designWithoutAFile));

            Assert.That(theError.Message, Is.StringMatching(
                "^Cannot create a product unless the Design has a file that exists on disk\\..+"
            ));
        }
コード例 #5
0
        public void you_must_supply_a_file_and_filename_with_the_design()
        {
            var designWithoutAFile = new Design {Filename = null};

            var theError = Assert.Throws<ArgumentException>(() => CreateCommand.Create(ProductSeed.WithName("xxx"), designWithoutAFile));

            Assert.That(theError.Message, Is.StringMatching("^Cannot create a product unless the Design has a file\\..+"));
        }
コード例 #6
0
        public void you_get_an_error_if_the_design_file_cannot_be_understood()
        {
            var designWithABungFile = new Design {Filename = "res\\not_an_eps_really.eps"};

            var theError = Assert.Throws<Exception>(() =>
                CreateCommand.Create(ProductSeed.WithName("xxx"), designWithABungFile)
            );

            Assert.That(theError.Message, Is.StringMatching(
                "\"Bad Request. Error processing design file\\(s\\).\""
            ));
        }
コード例 #7
0
        public void you_do_not_need_to_supply_a_material_with_the_design()
        {
            var designWithoutAMaterial = new Design {Filename = "res\\bottom_new.stl", MaterialKey = null};

            Assert.DoesNotThrow(() => CreateCommand.Create(ProductSeed.WithName("xxx"), designWithoutAMaterial));
        }