Ejemplo n.º 1
0
        public void XmlSerialize_ThrowNullReferenceException()
        {
            // Arrange
            var fileStream     = new FileStream(FileName, FileMode.OpenOrCreate);
            var _xmlSerializer = new SerializeToXMLProcessor <FlashObservation> {
                Stream = fileStream
            };

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => _xmlSerializer.Stream = null);
        }
Ejemplo n.º 2
0
        public void XmlSerialize_SerializeObject(double x, double y, double intensity, int duration)
        {
            // Arrange
            var fileStream     = new FileStream(FileName, FileMode.OpenOrCreate);
            var _xmlSerializer = new SerializeToXMLProcessor <FlashObservation> {
                Stream = fileStream
            };
            var observation = new FlashObservation(duration, intensity, new Coordinates(x, y), DateTime.UtcNow);

            // Act
            _xmlSerializer.OnNext(observation);
            fileStream = new FileStream(FileName, FileMode.Open);

            // Assert
            Assert.AreNotEqual(0, fileStream.Length);
            fileStream.Close();
        }