-
Notifications
You must be signed in to change notification settings - Fork 0
/
FourPartVersioningTests.cs
39 lines (32 loc) · 1.71 KB
/
FourPartVersioningTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.IO;
using NUnit.Framework;
namespace SemVerTests
{
class FourPartVersioningTests
{
[Test]
public void NugetUpgradesCanBreakASingleProduct()
{
var c_SharedLibrary_source = @"public class Utils {}";
var c_CompareEngineSource = @"public class Engine { public void DoWork() { new Utils(); } }";
var c_Ui_source = @"public class Ui { public void Show() { new Engine().DoWork(); } }";
var compiler = new Compiler();
// Compile the engine against the shared library
var oldSharedLibrary = compiler.CompileAndCopyLocal("SharedLibrary", c_SharedLibrary_source, version: new Version(18, 0, 0, 123)).Rename("SharedLibrary_old.dll");
var engine = compiler.CompileAndCopyLocal("Engine", c_CompareEngineSource, oldSharedLibrary);
// Meanwhile, the shared library is rebuilt
var newSharedLibrary = compiler.CompileAndCopyLocal("SharedLibrary", c_SharedLibrary_source, version: new Version(18, 0, 0, 456)).Rename("SharedLibrary_new.dll");
// The engine's nuspec indicates it's compatible with library versions [18.0.0.0, 19.0.0.0)
// So a nuget update in the UI solution will install the newer shared library
var productUi = compiler.CompileAndCopyLocal("UI", c_Ui_source, engine);
// SSMS comes along and loads everything
newSharedLibrary.CreateInstance("Utils");
engine.CreateInstance("Engine");
var ui = productUi.CreateInstance("Ui");
// But sadly...
var ex = Assert.Throws<FileNotFoundException>(() => ui.Show());
Console.WriteLine(ex);
}
}
}