public void Moneycontainer_CanHaveUnitializedMembers() { var p = new MoneyContainer(); var someMoney = new Money(0m, Currency.Dkk); Assert.That(p.PropName, Is.Not.EqualTo(someMoney)); }
public void CustomCurrencyLessConverter_ContainerObject_Exception() { var toSerialize = new MoneyContainer { PropName = new Money(14.3m, CurrencyIsoCode.XTS) }; Assert.That(() => JsonConvert.SerializeObject(toSerialize, new CurrencyLessMoneyConverter()), Throws.InstanceOf <NotImplementedException>()); }
private void btnDelete_Clicked(object sender, EventArgs e) { Button btn = (Button)sender; MoneyContainer container = btn.Data ["Container"] as MoneyContainer; if (container == null) { return; } list.Remove(container); RefreshGrid(); }
private void btnMore_Clicked(object sender, EventArgs e) { Button btn = (Button)sender; MoneyContainer container = btn.Data ["Container"] as MoneyContainer; if (container == null) { return; } container.Quantity++; RefreshGrid(); }
public void CustomCanonicalConverter_Container_UsesPascalCasedPropertyNamesAndAlphabeticCode() { var toSerialize = new MoneyContainer { PropName = new Money(14.3m, CurrencyIsoCode.XTS) }; JsConfig <Money> .RawSerializeFn = CanonicalMoneySerializer.Serialize; string actual = JsonSerializer.SerializeToString(toSerialize); Assert.That(actual, Is.EqualTo("{\"PropName\":{\"Amount\":14.3,\"Currency\":{\"IsoCode\":\"XTS\"}}}")); JsConfig <Money> .Reset(); }
private void btnLess_Clicked(object sender, EventArgs e) { Button btn = (Button)sender; MoneyContainer container = btn.Data ["Container"] as MoneyContainer; if (container == null) { return; } container.Quantity--; if (container.Quantity <= 0) { list.Remove(container); } RefreshGrid(); }
private void AddMoney(double amount, int quantity, bool refreshGrid = true) { MoneyContainer mc = list.Find(m => m.Amount.IsEqualTo(amount)); if (mc != null) { mc.Quantity += quantity; } else { list.Add(new MoneyContainer(amount, quantity)); } if (refreshGrid) { RefreshGrid(); } }
public void NullableDefaultConverterAndNonNullableCanonical_CanCoexist() { var notNull = new MoneyContainer { PropName = new Money(14.3m, CurrencyIsoCode.XTS) }; var @null = new NullableMoneyContainer { PropName = default(Money?) }; string actualNull = JsonConvert.SerializeObject(@null, new DefaultMoneyConverter(), new CanonicalNullableMoneyConverter()); string actualNotNull = JsonConvert.SerializeObject(notNull, new DefaultMoneyConverter(), new CanonicalNullableMoneyConverter()); Assert.That(actualNotNull, Is.EqualTo("{\"Name\":null,\"PropName\":{\"Amount\":14.3,\"Currency\":\"XTS\"}}")); Assert.That(actualNull, Is.EqualTo("{\"PropName\":null}")); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => { options.Filters.Add(new RequireHttpsAttribute()); }); // Add application services. services.AddAuthentication().AddGoogle(options => { options.ClientId = "34038796331-in4repsdgkmea6t145os8bm5eaua79fc.apps.googleusercontent.com"; options.ClientSecret = "PggquUC9na3IMnTQOfktIZto"; }); services.AddAuthentication().AddFacebook(options => { options.AppId = "1170050669797001"; options.AppSecret = "0bc2f0428dc209fcf0582c93f8ef3e0e"; }); services.AddAuthentication().AddTwitter(options => { options.ConsumerKey = "iAZzuoluuKt6IwqCgyReWjq8D"; options.ConsumerSecret = "wFINIn3CKMeWzhNzRo8gfHv2iZo2LDWR4SB2A9vMzFePkJlZnj"; }); services.AddSignalR(); services.AddTransient <IClaimsTransformation, MoneyClaimsTransformation>(f => new MoneyClaimsTransformation(f.GetService <IMoneyUserManager>(), f.GetService <IPermissionManager>())); MoneyContainer container = new MoneyContainer(); container.Add <ClassA>(); container.Add <ClassB>(); BuisenessFacade.Configuration = Configuration; BuisenessFacade.ConfigureServices(services); services.AddSingleton <IMoneyContainer, MoneyContainer>(i => container); }