Beispiel #1
0
        public void Should_return_null_when_property_name_is_null()
        {
            // Given
            var drop = new DynamicDrop(new object());

            // When
            var result = drop.BeforeMethod(null);

            // Then
            result.ShouldBeNull();
        }
Beispiel #2
0
        public void Should_return_null_when_model_is_null()
        {
            // Given
            var drop = new DynamicDrop(null);

            // When
            var result = drop.BeforeMethod(string.Empty);

            // Then
            result.ShouldBeNull();
        }
        public void Should_return_model_is_null_message_when_model_is_null()
        {
            // Given
            var drop = new DynamicDrop(null);

            // When
            var result = drop.BeforeMethod(string.Empty);

            // Then
            result.ShouldEqual("[Model is null]");
        }
Beispiel #4
0
        public void Should_return_null_when_model_is_null()
        {
            // Given
            var drop = new DynamicDrop(null);

            // When
            var result = drop.BeforeMethod(string.Empty);

            // Then
            result.ShouldBeNull();
        }
        public void Should_return_invalid_model_property_name_message_when_property_name_is_null()
        {
            // Given
            var drop = new DynamicDrop(new object());

            // When
            var result = drop.BeforeMethod(null);

            // Then
            result.ShouldEqual("[Invalid model property name]");
        }
        public void Should_return_model_is_null_message_when_model_is_null()
        {
            // Given
            var drop = new DynamicDrop(null);

            // When
            var result = drop.BeforeMethod(string.Empty);

            // Then
            result.ShouldEqual("[Model is null]");
        }
Beispiel #7
0
        public void Should_return_null_when_property_name_is_null()
        {
            // Given
            var drop = new DynamicDrop(new object());

            // When
            var result = drop.BeforeMethod(null);

            // Then
            result.ShouldBeNull();
        }
        public void Should_return_invalid_model_property_name_message_when_property_name_is_null()
        {
            // Given
            var drop = new DynamicDrop(new object());

            // When
            var result = drop.BeforeMethod(null);

            // Then
            result.ShouldEqual("[Invalid model property name]");
        }
        public void Should_return_message_about_property_not_being_found_when_called_with_invalid_property_name_and_model_is_object()
        {
            // Given
            var model = new FakeModel { Name = "Nancy" };
            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("age");

            // Then
            result.ShouldEqual("[Can't find :age in the model]");
        }
Beispiel #10
0
        public void Should_return_message_about_property_not_being_found_when_called_with_invalid_property_name_and_model_is_object()
        {
            // Given
            var model = new FakeModel {
                Name = "Nancy"
            };
            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("age");

            // Then
            result.ShouldEqual("[Can't find :age in the model]");
        }
Beispiel #11
0
        public void Should_return_null_when_called_with_invalid_property_name_and_model_is_expandoobject()
        {
            // Given
            dynamic model = new ExpandoObject();
            model.Name = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("age");

            // Then
            result.ShouldBeNull();
        }
Beispiel #12
0
        public void Should_return_null_when_called_with_invalid_property_name_and_model_is_object()
        {
            // Given
            var model = new FakeModel {
                Name = "Nancy"
            };
            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("age");

            // Then
            result.ShouldBeNull();
        }
Beispiel #13
0
        public void Should_return_model_value_when_property_name_is_valid_and_model_is_object()
        {
            // Given
            var model = new FakeModel {
                Name = "Nancy"
            };
            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("Name");

            // Then
            result.ShouldEqual("Nancy");
        }
Beispiel #14
0
        public void Should_return_model_value_when_property_name_is_valid_and_model_is_expandoobject()
        {
            // Given
            dynamic model = new ExpandoObject();
            model.Name = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("Name");

            // Then
            result.ShouldEqual("Nancy");
        }
Beispiel #15
0
        public void Should_return_model_value_when_property_name_is_wrong_case_and_model_is_expandoobject()
        {
            // Given
            dynamic model = new ExpandoObject();

            model.Name = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("name");

            // Then
            result.ShouldEqual("Nancy");
        }
Beispiel #16
0
        public void Should_unwrap_dynamicdictionaryvalue_when_model_is_dynamicdictionary()
        {
            // Given
            var model = new DynamicDictionary();

            model["Name"] = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("Name");

            // Then
            result.ShouldBeOfType <string>();
        }
Beispiel #17
0
        public void Should_return_model_value_when_property_name_is_valid_and_model_is_dynamicdictionary()
        {
            // Given
            var model = new DynamicDictionary();

            model["Name"] = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("Name");

            // Then
            result.ShouldEqual("Nancy");
        }
Beispiel #18
0
        public void Should_return_null_when_called_with_invalid_property_name_and_model_is_dynamicdictionary()
        {
            // Given
            var model = new DynamicDictionary();

            model["Name"] = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("age");

            // Then
            result.ShouldBeNull();
        }
Beispiel #19
0
        public void Should_return_model_value_when_property_name_is_valid_and_model_is_dynamicdictionary()
        {
            // Given
            var model = new DynamicDictionary();
            model["Name"] = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("Name");

            // Then
            result.ShouldEqual("Nancy");
        }
Beispiel #20
0
        public void Should_unwrap_dynamicdictionaryvalue_when_model_is_dynamicdictionary()
        {
            // Given
            var model = new DynamicDictionary();
            model["Name"] = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("Name");

            // Then
            result.ShouldBeOfType<string>();
        }
Beispiel #21
0
        public void Should_return_null_when_called_with_invalid_property_name_and_model_is_dynamicdictionary()
        {
            // Given
            var model = new DynamicDictionary();
            model["Name"] = "Nancy";

            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("age");

            // Then
            result.ShouldBeNull();
        }
Beispiel #22
0
        public void Should_return_model_value_when_property_name_is_valid_and_model_is_object()
        {
            // Given
            var model = new FakeModel { Name = "Nancy" };
            var drop = new DynamicDrop(model);

            // When
            var result = drop.BeforeMethod("Name");

            // Then
            result.ShouldEqual("Nancy");
        }