示例#1
0
        /// <summary>
        ///     Now try to understand this scenario, to call this method we need to pass these parameters.
        ///     Now there is no way to understand what these parameters are or how these parameters needs to be passed.
        ///     To find that we need to find Invoking Expression of "BusinessMethodDependency" and detects all it's parameter
        ///     initialize recursively.
        ///     To find dependencies we need to find the method "BusinessMethod" programmatically not hard coded fashion.
        ///     To test this method, we need to 2 setup methods
        ///         1.  Setup of Parameters from "BusinessMethod".
        ///         2.  Setup of inner properties (IntThrows, IntStaticThrows, PubliceByteProp, PublicStringProp), fields,
        ///         methods (ArgumentNullException, SomethingDynamicComplex, ThrowException,
        ///         BusinessLogicExampleOfSameplemethod, BusinessLogicExampleOfSamepleMethodString,
        ///         SampleMethod, SampleMethodString, ThrowException("Needs to be covered" + intX + y))
        /// </summary>
        /// <param name="somethingComplex"></param>
        /// <param name="sample"></param>
        /// <param name="classWithProperties"></param>
        /// <param name="classWithMethods"></param>
        /// <param name="required"></param>
        /// <param name="prep"></param>
        public void BusinessMethodDependency(dynamic somethingComplex,
                                             dynamic sample,
                                             ClassWithProperties classWithProperties,
                                             ClassWithMethods classWithMethods,
                                             IRequired required,
                                             IRequiredPrep prep)
        {
            Utility.ArgumentNullException("Testing"); // this method needs to be Faked
            somethingComplex.SomethingDynamicComplex();
            var x = classWithProperties.PubliceByteProp;
            var y = classWithProperties.PublicStringProp;

            Utility.ThrowException(); // this method needs to be Faked

            var classWithBusinessLogic = new ClassWithBusinessLogic(required);

            classWithBusinessLogic.BusinessLogicExampleOfSameplemethod();
            y = classWithBusinessLogic.BusinessLogicExampleOfSamepleMethodString() + x;

            var classWithBusinessLogic2 = new ClassWithBusinessLogic2();

            classWithBusinessLogic2.SampleMethodString();

            var requiredConcrete = new Required();

            requiredConcrete.SampleMethod(prep);
            requiredConcrete.SampleMethodString(prep);

            var intX = (int)sample + 5 + IntThrows + IntStaticThrows;

            Utility.ThrowException("Needs to be covered" + intX + y); // this method needs to be Faked and covered
        }
示例#2
0
 public ClassWithBusinessLogic(IRequired required, IRequiredPrep requiredPrep)
 {
     // You need to add these steps as fakes it could be real steps to call a method or property.
     _required            = required;
     _requiredPrep        = requiredPrep;
     _classWithProperties = new ClassWithProperties(_required);
     _classWithMethods    = new ClassWithMethods(_required);
 }
 public string SampleMethodString(IRequiredPrep prep)
 {
     // Remember there is not possibility of having the same method name like this.
     // This is just an example. So don't hard code anything.
     return(prep.SampleMethodString());
 }
 public void SampleMethod(IRequiredPrep prep)
 {
     // Remember there is not possibility of having the same method name like this.
     // This is just an example. So don't hard code anything.
     prep.SampleMethod();
 }
示例#5
0
 public SampleGetterValue(IRequiredPrep required, string w)
 {
 }
示例#6
0
 public void SampleMethod(IRequiredPrep prep)
 {
     prep.SampleMethod();
 }
 public void XampleMethod3(ExampleEnum1 exampleEnum1, IRequired example, IRequiredPrep rp)
 {
     Console.WriteLine(exampleEnum1);
 }
 public void XampleMethod3(dynamic p1, IRequired example, IRequiredPrep rp)
 {
     Console.WriteLine(p1);
 }