コード例 #1
0
ファイル: Program.cs プロジェクト: thomasbrueggemann/icebox
        private static void Run(Options opts)
        {
            foreach (string assemblyPath in opts.Assemblies)
            {
                var assembly = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath);

                var icebox     = new Icebox(assembly);
                var iceboxName = icebox.Name;
                if (iceboxName == null)
                {
                    Console.Error.WriteLine("⚠️ Assembly name could not be determined");
                }

                var writeContracts = icebox.Freeze();

                WriteToDisk(opts.OutputPath, iceboxName, writeContracts);
                Console.WriteLine("✅ Done! Icebox has been written. To checks were carried out, " +
                                  "since Icebox file did not exist prior to this run");
            }
        }
コード例 #2
0
            public void ShouldDetectABreakingDatatypeChange()
            {
                var assemblyMock = new Mock <Assembly>();

                assemblyMock.Setup(a => a.GetTypes()).Returns(new []
                {
                    typeof(TestSample)
                });

                var sut = new Icebox(assemblyMock.Object);

                var contracts = new List <IceboxedContract>
                {
                    new IceboxedContract(nameof(TestSample), new List <IceboxedContractMember>
                    {
                        new IceboxedContractMember(typeof(int), "Id")
                    })
                };

                var result = sut.FindMatchingTypesToIceboxedContracts(contracts);

                result.Succeeded.Should().BeFalse();
            }
コード例 #3
0
            public void ShouldNotDetectAnyBreakingChangesSinceThereAreNone()
            {
                var assemblyMock = new Mock <Assembly>();

                assemblyMock.Setup(a => a.GetTypes()).Returns(new []
                {
                    typeof(TestSample)
                });

                var sut = new Icebox(assemblyMock.Object);

                var contracts = new List <IceboxedContract>
                {
                    new IceboxedContract(nameof(TestSample), new List <IceboxedContractMember>
                    {
                        new IceboxedContractMember(typeof(string), "Id")
                    })
                };

                var result = sut.FindMatchingTypesToIceboxedContracts(contracts);

                result.Succeeded.Should().BeTrue();
            }