private void ClaimCircuitryWarranty(Action action) { Circuitry .WhenSome() .Do(c => CircuitryWarranty.Claim(c.DefectDetectedOn, action)) .Execute(); }
public void ClaimCircuitryWarranty(Action onValidClaim) { Circuitry.Do(circuitry => CircuitryWarranty.Claim(circuitry.DefectDetectedOn, onValidClaim) // These call may end in NullReferenceException; Circuitry object might be null; ); }
public void CircuitryNotOperational(DateTime detectedOn) { Circuitry.Do(circuitry => { circuitry.MarkDefective(detectedOn); CircuitryWarranty = FailedCircuitryWarranty; }); }
public void CircuitryNotOperational(DateTime detectedOn) { Circuitry.Do(C => { C.MarkAsDefective(detectedOn); OperationalStatus = OperationalStatus.CircuitryFailed(); }); }
public void CircuitryNotOperational(DateTime detectedOn) { Circuitry .WhenSome() .Do(c => { c.MarkDefective(detectedOn); // OperationStatus = OperationStatus.CircuitryFailed(); }); }
//public void CircuitryNotOperational(DateTime detectedOn) //{ // if (Circuitry != null) // { // Circuitry.MarkAsDefective(detectedOn); // CircuitryWarranty = FailedCircuitryWarranty; // } //} //public void CircuitryNotOperational(DateTime detectedOn) //{ // Circuitry.ForEach(circuitry => // { // circuitry.MarkAsDefective(detectedOn); // CircuitryWarranty = FailedCircuitryWarranty; // }); //} public void CircuitryNotOperational(DateTime detectedOn) { //Circuitry.ToList().ForEach(circuitry => //{ // circuitry.MarkAsDefective(detectedOn); // CircuitryWarranty = FailedCircuitryWarranty; //}); Circuitry.Do(circuitry => { circuitry.MarkAsDefective(detectedOn); CircuitryWarranty = FailedCircuitryWarranty; }); }
// Easiest way to implement Optional Object is to implement as a collection; public void CircuitryNotOperational(DateTime detectedOn) { Circuitry .WhenSome() .Do(c => { c.MarkDefective(detectedOn); OperationalStatus = OperationalStatus.CircuitryFailed(); }) .Execute(); //Circuitry.Do(circuitry => // if null (no objects in the List) then ForEach not executed // { // circuitry.MarkDefective(detectedOn); // These call may end in NullReferenceException // CircuitryWarranty = FailedCircuitryWarranty; // } //); }
//public void ClaimCircuitryWarranty(Action onValidClaim) //{ // if (Circuitry != null) // { // CircuitryWarranty.Claim(Circuitry.DefectDetectedOn, onValidClaim); // } //} //public void ClaimCircuitryWarranty(Action onValidClaim) //{ // Circuitry.ForEach(circuitry => CircuitryWarranty.Claim(circuitry.DefectDetectedOn, onValidClaim)); //} public void ClaimCircuitryWarranty(Action onValidClaim) { //Circuitry.ToList().ForEach(circuitry => CircuitryWarranty.Claim(circuitry.DefectDetectedOn, onValidClaim)); Circuitry.Do(circuitry => CircuitryWarranty.Claim(circuitry.DefectDetectedOn, onValidClaim)); }
public void ClaimCircuitryWarranty(Action onValidClaim) { Circuitry .Do(circuitry => CircuitryWarranty.Claim(circuitry.DefectDetectedOn, onValidClaim)); }
private void ClaimCircuitryWarranty(Action action) { Circuitry.Do(c => CircutryWarranty.Claim(c.DefectDetectedOn, action)); }