Fix MemoryFile to update last modified time when writeAs* is called (#50)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9cc3c0..e136c32 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+#### 2.3.1
+
+* Fixed `MemoryFileSystem` to make `File.writeAs...()` update the last modified
+  time of the file.
+
 #### 2.3.0
 
 * Added the following convenience methods in `Directory`:
diff --git a/lib/src/backends/memory/memory_file.dart b/lib/src/backends/memory/memory_file.dart
index 6d9368e..a26c4d0 100644
--- a/lib/src/backends/memory/memory_file.dart
+++ b/lib/src/backends/memory/memory_file.dart
@@ -235,6 +235,7 @@
     _FileNode node = _resolvedBackingOrCreate;
     _truncateIfNecessary(node, mode);
     node.content.addAll(bytes);
+    node.touch();
   }
 
   @override
diff --git a/lib/src/backends/memory/node.dart b/lib/src/backends/memory/node.dart
index 8cc103d..316695a 100644
--- a/lib/src/backends/memory/node.dart
+++ b/lib/src/backends/memory/node.dart
@@ -84,6 +84,11 @@
 
   /// The size of the file system entity in bytes.
   int get size;
+
+  /// Updates the last modified time of the node.
+  void touch() {
+    modified = new DateTime.now().millisecondsSinceEpoch;
+  }
 }
 
 /// Class that represents the backing for an in-memory directory.
diff --git a/pubspec.yaml b/pubspec.yaml
index 047b297..a63d8ed 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: file
-version: 2.3.0
+version: 2.3.1
 authors:
 - Matan Lurey <matanl@google.com>
 - Yegor Jbanov <yjbanov@google.com>
diff --git a/test/common_tests.dart b/test/common_tests.dart
index 468a263..c87fd8a 100644
--- a/test/common_tests.dart
+++ b/test/common_tests.dart
@@ -2492,6 +2492,15 @@
           f.writeAsBytesSync(<int>[]);
           expect(f.readAsBytesSync(), <int>[]);
         });
+
+        test('updatesLastModifiedTime', () async {
+          File f = fs.file(ns('/foo'))..createSync();
+          DateTime before = f.statSync().modified;
+          await new Future<Null>.delayed(const Duration(seconds: 2));
+          f.writeAsBytesSync(<int>[1, 2, 3]);
+          DateTime after = f.statSync().modified;
+          expect(after, isAfter(before));
+        });
       });
 
       group('writeAsString', () {
diff --git a/test/utils.dart b/test/utils.dart
index 40e7b3b..9c5ad9d 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -36,6 +36,10 @@
 /// the specified [time].
 Matcher isSameOrAfter(DateTime time) => new _IsSameOrAfter(time);
 
+/// Successfully matches against a [DateTime] that is after the specified
+/// [time].
+Matcher isAfter(DateTime time) => new _IsAfter(time);
+
 abstract class _CompareDateTime extends Matcher {
   final DateTime _time;
   final Matcher _matcher;
@@ -93,3 +97,13 @@
   @override
   String get mismatchAdjective => 'before';
 }
+
+class _IsAfter extends _CompareDateTime {
+  const _IsAfter(DateTime time) : super(time, isPositive);
+
+  @override
+  String get descriptionOperator => '>';
+
+  @override
+  String get mismatchAdjective => 'before';
+}