Coder Social home page Coder Social logo

developwithpassion.specifications's People

Contributors

bobpace avatar developwithpassion avatar igor-toporet avatar jeffbarnes avatar notherdev avatar rho24 avatar shilin-he avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

developwithpassion.specifications's Issues

Exception "Property set method not found" when observing class with null property

When I run this code on version 0.4.21.5:

public class Test
{
    public string Property
    {
        get { return null; }
    }
}

public class when_observing_test : Observes<Test>
{
    It should_not_fail_but_it_does = () => Console.WriteLine("Will fail");
}

I get:

System.ArgumentException: Property set method not found.
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at developwithpassion.specifications.core.reflection.PropertyInfoMemberAccessor.change_value_to(Object target, Object new_value) in PropertyInfoMemberAccessor.cs: line 27
at developwithpassion.specifications.core.factories.NonCtorDependencySetter.<>c__DisplayClass7.<attempt_to_update_all_of_the_accessors>b__5(MemberAccessor accessor) in NonCtorDependencySetter.cs: line 42
at developwithpassion.specifications.extensions.IterationExtensions.each(IEnumerable1 items, Action1 action) in IterationExtensions.cs: line 13
at developwithpassion.specifications.core.factories.NonCtorDependencySetter.attempt_to_update_all_of_the_accessors(IEnumerable1 accessors_to_update, Object target) in NonCtorDependencySetter.cs: line 40 at developwithpassion.specifications.core.factories.NonCtorDependencySetter.update(Object item) in NonCtorDependencySetter.cs: line 35 at developwithpassion.specifications.faking.DefaultSUTFactory1.create_automatically() in DefaultSUTFactory.cs: line 32
at developwithpassion.specifications.faking.DefaultSUTFactory1.create() in DefaultSUTFactory.cs: line 23 at developwithpassion.specifications.DefaultTestStateFor1.build_sut() in DefaultTestStateFor.cs: line 32
at developwithpassion.specifications.DefaultTestStateFor1.run_setup() in DefaultTestStateFor.cs: line 43 at developwithpassion.specifications.DefaultObservationController2.run_setup() in DefaultObservationController.cs: line 51
at developwithpassion.specifications.observations.InstanceObservations`3.<.ctor>b__0() in InstanceObservations.cs: line 14

In my production code Test.Property isn't really implemented like that. It's a calculated property and it just returns null in certain situations. Our unit tests fail then.

When Test class looks like this:
public class Test
{
public string Property
{
get { return "property value"; }
}
}

all works fine.

It was working ok with version 0.4.13.0 which we were using previously.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.