Skip to content

Commit d7c4928

Browse files
committed
Rework
1 parent e43c6ce commit d7c4928

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

tests/MSBuildDeviceIntegration/Tests/InstallTests.cs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -469,12 +469,13 @@ public void IncrementalFastDeployment ()
469469
AssertCommercialBuild ();
470470
AssertHasDevices ();
471471

472+
var class1src = new BuildItem.Source ("Class1.cs") {
473+
TextContent = () => "namespace Library1 { public class Class1 { public static int foo = 0; } }"
474+
};
472475
var lib1 = new XamarinAndroidLibraryProject () {
473476
ProjectName = "Library1",
474477
Sources = {
475-
new BuildItem.Source ("Class1.cs") {
476-
TextContent = () => "namespace Library1 { public class Class1 { } }"
477-
},
478+
class1src,
478479
}
479480
};
480481

@@ -505,33 +506,45 @@ public void IncrementalFastDeployment ()
505506
using (var lb2 = CreateDllBuilder (Path.Combine (rootPath, lib2.ProjectName)))
506507
Assert.IsTrue (lb2.Build (lib2), "Second library build should have succeeded.");
507508

509+
long lib1FirstBuildSize = new FileInfo (Path.Combine (rootPath, lib1.ProjectName, lib1.OutputPath, "Library1.dll")).Length;
510+
508511
using (var builder = CreateApkBuilder (Path.Combine (rootPath, app.ProjectName))) {
509512
builder.ThrowOnBuildFailure = false;
513+
builder.BuildLogFile = "install.log";
510514
Assert.IsTrue (builder.Install (app), "First install should have succeeded.");
511515
var logLines = builder.LastBuildOutput;
516+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("UnnamedProject.dll")), "UnnamedProject.dll should have been uploaded");
517+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("Library1.dll")), "Library1.dll should have been uploaded");
512518
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("Library2.dll")), "Library2.dll should have been uploaded");
513519
var firstInstallTime = builder.LastBuildTime;
520+
builder.BuildLogFile = "install2.log";
514521
Assert.IsTrue (builder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), "Second install should have succeeded.");
515522
var secondInstallTime = builder.LastBuildTime;
516523

517524
var filesToTouch = new [] {
518-
Path.Combine (rootPath, lib1.ProjectName, "Class1.cs"),
525+
Path.Combine (rootPath, lib2.ProjectName, "Class2.cs"),
519526
Path.Combine (rootPath, app.ProjectName, "MainPage.xaml"),
520527
};
521528
foreach (var file in filesToTouch) {
522529
FileAssert.Exists (file);
523530
File.SetLastWriteTimeUtc (file, DateTime.UtcNow);
524531
}
525532

526-
class2src.TextContent = () => "namespace Library2 { public class Class2 { public static int foo = 100; } }";
527-
using (var lb2 = CreateDllBuilder (Path.Combine (rootPath, lib2.ProjectName)))
528-
Assert.IsTrue (lb2.Build (lib2), "Second library build should have succeeded.");
533+
class1src.TextContent = () => "namespace Library1 { public class Class1 { public static int foo = 100; } }";
534+
using (var lb1 = CreateDllBuilder (Path.Combine (rootPath, lib1.ProjectName)))
535+
Assert.IsTrue (lb1.Build (lib1), "Second library build should have succeeded.");
536+
537+
long lib1SecondBuildSize = new FileInfo (Path.Combine (rootPath, lib1.ProjectName, lib1.OutputPath, "Library1.dll")).Length;
538+
Assert.AreEqual (lib1FirstBuildSize, lib1SecondBuildSize, "Library2.dll was not the same size.");
529539

540+
builder.BuildLogFile = "install3.log";
530541
Assert.IsTrue (builder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), "Third install should have succeeded.");
542+
logLines = builder.LastBuildOutput;
531543
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("UnnamedProject.dll")), "UnnamedProject.dll should have been uploaded");
532-
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("Library2.dll")), "Library2.dll should have been uploaded");
533-
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync SkipCopyFile") && l.Contains ("Library1.dll")), "Library1.dll should not have been uploaded");
544+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("Library1.dll")), "Library1.dll should have been uploaded");
545+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync SkipCopyFile") && l.Contains ("Library2.dll")), "Library2.dll should not have been uploaded");
534546
var thirdInstallTime = builder.LastBuildTime;
547+
builder.BuildLogFile = "install4.log";
535548
Assert.IsTrue (builder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), "Fourth install should have succeeded.");
536549
var fourthInstalTime = builder.LastBuildTime;
537550

0 commit comments

Comments
 (0)