public void With_Config_GeneratesValueByConfig() { // Arrange var fillingConfig = FakeUpLib.FakeUp.Config.Create <ValuesHolder <string> >(options => options .FillAll <string>().With(ctx => ctx.InvocationPath) ); // Act var instance = FakeUpLib.FakeUp.NewObject <ValuesHolder <ValuesHolder <string> > >(o => o .FillAll <string>().With("constant") .Fill(vh => vh.Value2).With(fillingConfig) ); // Assert var expected = new ValuesHolder <ValuesHolder <string> >() { Value1 = new ValuesHolder <string>() { Value1 = "constant", Value2 = "constant", Value3 = "constant" }, Value2 = new ValuesHolder <string>() { Value1 = "Value1", Value2 = "Value2", Value3 = "Value3" }, Value3 = new ValuesHolder <string>() { Value1 = "constant", Value2 = "constant", Value3 = "constant" } }; instance.ShouldBeEquivalentTo(expected); }
public int DoRoman(string input) { ValuesHolder holder = new ValuesHolder(); holder.PropertyChanged += Holder_PropertyChanged; holder.ArabicValue = 10; RDM = new RomanDictModel(); int res = 0; input = input.ToUpper(); if (input.Length == 0) { return(0); } //wanted to try to be fancy and build a smarter algorithm //for(int i = 0; i < input.Length; i++) //{ // String n = input[i].ToString(); // if(CheckCXI(input[i])) // { // if (i != input.Length-1 && !CheckCXI(input[i + 1])) // { // i++; // n += input[i].ToString(); // res += RDM.romanMap[n]; // } // else // { // res += RDM.romanMap[n]; // } // } // else // { // res += RDM.romanMap[n]; // } //} int oldVal = 0; //parses from the back forward for (int i = input.Length - 1; i >= 0; i--) { int newVal = RDM.romanMap[input[i]]; //if the next value is a 1/10/100 prior to a 5/10/50/100/500/1000 if (newVal < oldVal) { res -= newVal; } else { res += newVal; oldVal = newVal; } } return(res); }
public WeatherController(ValuesHolder holder) { this.holder = holder; }
public Char(string defName, ValuesHolder properties, ValuesHolder tags) : base(defName, properties, tags) { }
public CrudController(ValuesHolder holder) { this.holder = holder; }