Ejemplo n.º 1
0
        public void ShouldInstanceNameBeNull()
        {
            Story instanceNameStory = new Story("Should instance name be null");

            QuartzAdmin.web.Models.InstanceModel instance = null;
            instanceNameStory
            .AsA("System Admin")
            .IWant("to create a new quartz instance")
            .SoThat("I can administer it using this tool");

            instanceNameStory
            .WithScenario("Create new instance with null name")
            .Given("The instance name is", null, delegate(string instanceName)
            {
                instance = new QuartzAdmin.web.Models.InstanceModel();
                instance.InstanceName = instanceName;
            })
            .And("The instance has properties", delegate(){ instance.InstanceProperties.Add(new QuartzAdmin.web.Models.InstancePropertyModel()
                {
                    PropertyName = "Hello", PropertyValue = "World"
                }); })
            .When("the instance is validated")
            .Then("the validation should fail", delegate() {
                Assert.IsFalse(instance.IsValid());
            });


            instanceNameStory
            .WithScenario("Create new instance name and with no properties")
            .Given("The instance name is", null, delegate(string instanceName)
            {
                instance = new QuartzAdmin.web.Models.InstanceModel();
                instance.InstanceName = instanceName;
            })
            .And("The instance has properties", delegate() { instance.InstanceProperties.Add(new QuartzAdmin.web.Models.InstancePropertyModel()
                {
                    PropertyName = "Hello", PropertyValue = "World"
                }); })
            .When("the instance is validated")
            .Then("the validation should fail", delegate()
            {
                Assert.IsFalse(instance.IsValid());
            });
        }
        public void ShouldInstancePropertiesBeEmpty()
        {


            Story instanceNameStory = new Story("Should instance name be null");
            QuartzAdmin.web.Models.InstanceModel instance = null;
            instanceNameStory
                .AsA("System Admin")
                .IWant("to create a new quartz instance")
                .SoThat("I can administer it using this tool");

            instanceNameStory
                .WithScenario("Create new instance with empty properties")
                .Given("The instance name is", "HelloWorld", delegate(string instanceName)
                {
                    instance = new QuartzAdmin.web.Models.InstanceModel();
                    instance.InstanceName = instanceName;

                })
                .When("the instance is validated")
                .Then("the validation should fail", delegate(){Assert.IsFalse(instance.IsValid());});

        }