示例#1
0
        static void Main(string[] args)
        {
            var stream = new MassStream(5, MassUnits.Tone, TimeUnits.Hour);

            Console.WriteLine("stream = " + stream);

            stream = stream.WithCounterUnit(MassUnits.Kg);
            Console.WriteLine("stream = " + stream);

            stream = stream.WithDenominatorUnit(TimeUnits.Second)
                     .Round(3);
            Console.WriteLine("stream = " + stream);
        }
        public void T01_Should()
        {
            var stream = new MassStream(10, MassUnits.Kg, TimeUnits.Second);

            Assert.Equal("10kg/s", stream.ToString());

            stream = stream.WithDenominatorUnit(TimeUnits.Hour);
            Assert.Equal(
                new MassStream(36000, MassUnits.Kg, TimeUnits.Hour),
                stream);

            stream = stream.WithCounterUnit(MassUnits.Tone);
            Assert.Equal(
                new MassStream(36, MassUnits.Tone, TimeUnits.Hour),
                stream);
        }