public void Should_initialize_instance(double value) { var actual = new Kelvin(value); Assert.IsAssignableFrom <Kelvin>(actual); Assert.AreEqual(value, actual.Value, nameof(actual.Value)); }
public CurrentConditions(long pressure, Kelvin temperature, long humidity, string sourceId) { this.Pressure = pressure; this.Temperature = temperature; this.Humidity = humidity; this.SourceId = sourceId; }
public void KelvinAddNullTest() { double temp1 = 20; var kelvin = new Kelvin(temp1); Assert.AreEqual(kelvin.Value, (kelvin + null).Value); }
public CompoundPhysicalProperties(float molarMass, float density, Kelvin meltingT, Kelvin boilingT) { MolarMass = molarMass; Density = density; MeltingT = meltingT; BoilingT = boilingT; }
public void Should_not_throw_exception_on_division_by_zero(double value, double expectedValue) { var instance = new Kelvin(value); var actual = instance / 0d; Assert.AreEqual(expectedValue, actual.Value); }
static void Main(string[] args) { Kelvin k1 = 285.927777777778; Fahrenheit f1 = (Fahrenheit)k1; Celcius c1 = (Celcius)k1; Celcius c2 = 12.7777777777778; Fahrenheit f2 = (Fahrenheit)c2; Kelvin k2 = (Kelvin)c2; Fahrenheit f3 = 55; Celcius c3 = (Celcius)f3; Kelvin k3 = (Kelvin)f3; Console.WriteLine(k1.GetCantidad); Console.WriteLine(c1.GetCantidad); Console.WriteLine(f1.GetCantidad); Console.WriteLine(k2.GetCantidad); Console.WriteLine(c2.GetCantidad); Console.WriteLine(f2.GetCantidad); Console.WriteLine(k3.GetCantidad); Console.WriteLine(c3.GetCantidad); Console.WriteLine(f3.GetCantidad); Console.ReadKey(); }
public void Should_compare_with_null_instance(double value) { var instance = new Kelvin(value); Assert.IsFalse(instance.Equals(null), "Equals"); Assert.AreEqual(1, instance.CompareTo(null), "CompareTo"); }
/// <summary> /// Use Kelvin too /// </summary> /// <returns>the catalog deserialized from disk, or NULL</returns> public static Catalog Load() { if (Preferences.InMediumTrust) { // added v5 string xmlFileName = Path.GetDirectoryName(Preferences.CatalogFileName) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(Preferences.CatalogFileName) + ".xml"; if (System.IO.File.Exists(xmlFileName)) { Catalog c1 = Kelvin <Catalog> .FromXmlFile(xmlFileName); return(c1); } } //Catalog c0 = Kelvin<Catalog>.FromBinaryFile(Preferences.CatalogFileName + "_Kelvin.dat"); //Catalog c1 = Kelvin<Catalog>.FromXmlFile(Preferences.CatalogFileName + "_Kelvin.xml"); //string[] words = Kelvin<string[]>.FromXmlFile(Preferences.CatalogFileName + "_words_Kelvin.xml"); if (System.IO.File.Exists(Preferences.CatalogFileName)) { object deserializedCatalogObject; using (System.IO.Stream stream = new System.IO.FileStream(Preferences.CatalogFileName, System.IO.FileMode.Open)) { System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); //object m = formatter.Deserialize (stream); // This doesn't work, SerializationException "Cannot find the assembly <random name>" formatter.Binder = new CatalogBinder(); // This custom Binder is REQUIRED to find the classes in our current 'Temporary ASP.NET Files' assembly deserializedCatalogObject = formatter.Deserialize(stream); } //stream.Close(); Catalog catalog = deserializedCatalogObject as Catalog; return(catalog); } else { return(null); } }
public Conversor() { InitializeComponent(); this.far = new Fahrenheit(0); this.cel = new Celsius(0); this.kel = new Kelvin(0); }
private void btnConvKelvin_Click(object sender, EventArgs e) { double _Kelvin; if (Validacion.validTxtWithNum(txtKelvin.Text)) { _Kelvin = double.Parse(txtKelvin.Text); Kelvin temperature = _Kelvin; StringBuilder cadena = new StringBuilder(); cadena.AppendFormat("{0:#.##}°C", Celcius.ConvertToCelcius(temperature)); txtKelvinToCelcius.Text = cadena.ToString(); cadena.Clear(); cadena.AppendFormat("{0:#.##}°F", Fahrenheit.ConvertToFahrenheit(temperature)); txtKelvinToFahrenheit.Text = cadena.ToString(); cadena.Clear(); cadena.AppendFormat("{0:#.##}°K", _Kelvin); txtKelvinToKelvin.Text = cadena.ToString(); } else { MessageBox.Show("El campo esta vacio o contiene un valor incorrecto"); } }
static void Main(string[] args) { prototipo prototipo = new prototipo(); Kelvin kelvin = new Kelvin(); Celsius celsius = new Celsius(); Farenheit farenheit = new Farenheit(); int input; prototipo.inicio(); input = Convert.ToInt32(Console.ReadLine()); if (input == 1) { farenheit.ResolucionFarenheit(); } else if (input == 2) { celsius.ResolucionCelsius(); } else if (input == 3) { kelvin.ResolucionKelvin(); } Console.ReadKey(); }
static void Main(string[] args) { // Celsius c1 = new Celsius(100); // Kelvin k1; // Fahrenheit f1; // f1 = (Fahrenheit)c1; // k1 = (Kelvin)f1; // Celsius c2 = (Celsius)f1; // Fahrenheit f2 = (Fahrenheit)c2; // Kelvin k2 = (Kelvin)f2; // Console.WriteLine("Grados Celcius: {0} equivale a {1} grados Farenheit",c1.GetTemperatura(),f1.GetTemperatura()); // Console.WriteLine("Grados Kelvin {0}",k1.GetTemperatura()); // Console.WriteLine("Celcius {0}",c2.GetTemperatura()); // Console.WriteLine("Farenhait {0}",f2.GetTemperatura()); // Console.WriteLine("Kelvin {0} ",k2.GetTemperatura()); Celsius c1 = new Celsius(100); Fahrenheit f1 = (Fahrenheit)c1; Kelvin k1 = (Kelvin)c1; Console.WriteLine("Kelvin: {0} \nFaren {1}", f1.GetTemperatura(), k1.GetTemperatura()); Console.ReadKey(); }
static void Main(string[] args) { Fahrenheit f1 = new Fahrenheit(20); Fahrenheit f2 = new Fahrenheit(0); Celsius c1 = new Celsius(20); Celsius c2 = new Celsius(0); Kelvin k1 = new Kelvin(20); Kelvin k2 = new Kelvin(0); Kelvin k3 = new Kelvin(0); f1 = f1 + c1; Console.WriteLine(f1.ToString()); c2 = c2 + k1; Console.WriteLine(c2.ToString()); k2 = k2 + c1; Console.WriteLine(k2.ToString()); c2 = k2; if (c2 == k2) { Console.WriteLine("Son iguales"); } Console.ReadKey(); }
public void Should_compare_with_another_type_of_instance(double value) { var instance1 = new Kelvin(value); object instance2 = value; Assert.IsFalse(instance1.Equals(instance2), "Equals"); Assert.Throws <ArgumentException>(() => instance1.CompareTo(instance2), "CompareTo"); }
public void Should_cast_to_double(double value) { var instance = new Kelvin(value); var actual = (double)instance; Assert.AreEqual(value, actual); }
private void btnConvertK_Click(object sender, EventArgs e) { Kelvin value = new Kelvin(Convert.ToDouble(txtFValue.Text)); txtKF.Text = ((Fahrenheit)value).GetGrados().ToString("0.00"); txtKC.Text = ((Celsius)value).GetGrados().ToString("0.00"); txtKK.Text = txtFValue.Text; }
private void btnK_Click(object sender, EventArgs e) { Kelvin input = new Kelvin(Convert.ToDouble(txtKIn.Text)); txtKK.Text = txtKIn.Text; txtKF.Text = ((Fahrenheit)input).GetGrados().ToString("0.##"); txtKC.Text = ((Celsius)input).GetGrados().ToString("0.##"); }
private void btnKelvin_Click(object sender, EventArgs e) { Kelvin entrada = new Kelvin(Convert.ToDouble(txtKelvin.Text)); txtKelvinAFar.Text = ((Fahrenheit)entrada).GetGrados().ToString("0.##"); txtKelvinACelsius.Text = ((Celsius)entrada).GetGrados().ToString("0.##"); txtKelvinAKelvin.Text = txtKelvin.Text; }
public void Should_convert_from_kelvin(double kelvin, double expected) { var instance = new Kelvin(kelvin); Celsius actual = instance; Assert.AreEqual(expected, actual.Value, Consts.DeltaAssert); }
public void Should_convert_to_kelvin(double celsius, double expected) { var instance = new Celsius(celsius); Kelvin actual = instance; Assert.AreEqual(expected, actual.Value, Consts.DeltaAssert); }
public void InRangeEmptyConstructorTest() { var kelvin = new Kelvin { Value = 500 }; Assert.AreEqual(500, kelvin.Value, double.Epsilon); }
public void SaveFavouritesFile() { var basedir = Path.Combine(Constants.DocumentsFolder, CurrentConferenceCode); var xmlPath = Path.Combine(basedir, "Favourites.xml"); Console.WriteLine("[Main] SaveFeedbackFile"); Kelvin <List <Session2> > .ToXmlFile(Conf.Current.FavoriteSessions, xmlPath); }
public void Should_cast_from_double(double value) { var expected = new Kelvin(value); var actual = (Kelvin)value; Assert.AreEqual(expected, actual); }
private void btnWriteSettingsForConsole_Click(object sender, EventArgs e) { var fileinfo = GetSettingsFileInfo(); Kelvin <ColourDetectSettings> .ToXmlFile(GetColourDetectSettings(), fileinfo.FullName); NotifyStatus("Wrote settings to '{0}'", fileinfo.FullName); }
public void Should_convert_to_Kelvin(double fahrenheit, double expected) { var instance = new Fahrenheit(fahrenheit); Kelvin actual = instance; Assert.AreEqual(expected, actual.Value, Consts.DeltaAssert); }
public void Should_have_absolute_zero() { var expected = new Kelvin(0); var actual = Kelvin.AbsoluteZero; Assert.AreEqual(expected, actual); }
public void Should_convert_to_international_system(double value) { var expected = new Kelvin(value); var actual = (expected as ITemperatureUnit).ToKelvin(); Assert.AreEqual(expected, actual); }
public AtmosphereState(string name, int update, Guid self, ResourceComposition[] composition, Pascal pressure, Kelvin temperature) { this.name = name; this.update = update; this.self = self; this.pressure = pressure; this.temperature = temperature; this.composition = composition; }
public void Should_own_a_HashCode(double value) { var expected = value.GetHashCode(); var instance = new Kelvin(value); var actual = instance.GetHashCode(); Assert.AreEqual(expected, actual); }
public void Should_round_value_withDigit(double value, double expectedValue) { var expected = new Kelvin(expectedValue); var instance = new Kelvin(value); var actual = instance.Round(1); Assert.AreEqual(expected, actual); }