public void SetUp() { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "files", "LOFT_ECSS-E-TM-10-25_AnnexC.zip"); var migrationSourceFile = Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\files", "migration.json"); this.annexC3File = Path.Combine(TestContext.CurrentContext.TestDirectory, "files", "AnnexC3.zip"); this.migrationFile = Path.Combine(TestContext.CurrentContext.TestDirectory, "files", "migration.json"); if (!File.Exists(this.migrationFile)) { File.Copy(migrationSourceFile, this.migrationFile); } this.cancelationTokenSource = new CancellationTokenSource(); this.credentials = new Credentials("admin", "pass", new Uri(path)); this.session = new Mock <ISession>(); this.dal = new JsonFileDal { Session = this.session.Object }; this.siteDirectoryData = new SiteDirectory(); this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDirectoryData); this.session.Setup(x => x.Credentials).Returns(this.credentials); }
public void SetUp() { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "files", "minimalcontent.zip"); this.credentials = new Credentials("admin", "pass", new Uri(path)); this.dal = new JsonFileDal(); this.session = new Session(this.dal, this.credentials); }
public async Task Verify_that_when_uri_path_does_not_exist_exception_is_thrown() { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "files", "does_not_exist.zip"); this.credentials = new Credentials("admin", "pass", new Uri(path)); var jsonfiledal = new JsonFileDal(); Assert.ThrowsAsync <FileLoadException>(async() => await jsonfiledal.Open(this.credentials, this.cancelationTokenSource.Token)); }
public void VerifyCtorWithVersion() { this.dal = new JsonFileDal(new Version("1.0.0")); Assert.IsTrue(this.dal.Serializer.RequestDataModelVersion.Major == 1); Assert.IsTrue(this.dal.Serializer.RequestDataModelVersion.Minor == 0); Assert.IsTrue(this.dal.Serializer.RequestDataModelVersion.Build == 0); this.dal = new JsonFileDal(null); Assert.IsTrue(this.dal.DalVersion.Major == 1); Assert.IsTrue(this.dal.DalVersion.Minor == 2); Assert.IsTrue(this.dal.DalVersion.Build == 0); }
public void VerifyCtorWithVersion() { this.dal = new JsonFileDal(new Version("1.0.0")); Assert.That(this.dal.Serializer.RequestDataModelVersion.Major, Is.EqualTo(1)); Assert.That(this.dal.Serializer.RequestDataModelVersion.Minor, Is.EqualTo(0)); Assert.That(this.dal.Serializer.RequestDataModelVersion.Build, Is.EqualTo(0)); this.dal = new JsonFileDal(null); Assert.That(this.dal.DalVersion.Major, Is.EqualTo(1)); Assert.That(this.dal.DalVersion.Minor, Is.EqualTo(2)); Assert.That(this.dal.DalVersion.Build, Is.EqualTo(0)); }
public async Task SetUp() { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Data", "allvaluesettypes.zip"); this.uri = new Uri(path); this.credentials = new Credentials("admin", "pass", this.uri); this.dal = new JsonFileDal(); this.session = new Session(this.dal, this.credentials); await this.session.Open(); this.nestedElementTreeGenerator = new NestedElementTreeGenerator(); }
public void TearDown() { this.credentials = null; this.dal = null; if (File.Exists(this.annexC3File)) { File.Delete(this.annexC3File); } if (File.Exists(this.migrationFile)) { File.Delete(this.migrationFile); } }
public void VerifyCtorWithVersionAndCopyright() { this.dal = new JsonFileDal(new Version("1.0.0")); const string COPYRIGHT = "Copyright 2020 © ESA."; const string REMARK = "This is custom ECSS-E-TM-10-25 exchange file"; Assert.IsTrue(this.dal.Serializer.RequestDataModelVersion.Major == 1); Assert.IsTrue(this.dal.Serializer.RequestDataModelVersion.Minor == 0); Assert.IsTrue(this.dal.Serializer.RequestDataModelVersion.Build == 0); this.dal.UpdateExchangeFileHeader(new Person { ShortName = "admin" }); Assert.IsInstanceOf(typeof(Json.ExchangeFileHeader), this.dal.FileHeader); this.dal.UpdateExchangeFileHeader(new Person { ShortName = "admin" }, COPYRIGHT, REMARK); Assert.IsTrue(this.dal.FileHeader.Copyright == COPYRIGHT); Assert.IsTrue(this.dal.FileHeader.Remark == REMARK); }
public void VerifyCtorWithVersionAndCopyright() { this.dal = new JsonFileDal(new Version("1.0.0")); const string COPYRIGHT = "Copyright 2020 © RHEA Group."; const string REMARK = "This is custom ECSS-E-TM-10-25 exchange file"; Assert.That(this.dal.Serializer.RequestDataModelVersion.Major, Is.EqualTo(1)); Assert.That(this.dal.Serializer.RequestDataModelVersion.Minor, Is.EqualTo(0)); Assert.That(this.dal.Serializer.RequestDataModelVersion.Build, Is.EqualTo(0)); this.dal.UpdateExchangeFileHeader(new Person { ShortName = "admin" }); Assert.That(this.dal.FileHeader, Is.InstanceOf <CDP4JsonFileDal.Json.ExchangeFileHeader>()); this.dal.UpdateExchangeFileHeader(new Person { ShortName = "admin" }, COPYRIGHT, REMARK); Assert.That(this.dal.FileHeader.Copyright, Is.EqualTo(COPYRIGHT)); Assert.That(this.dal.FileHeader.Remark, Is.EqualTo(REMARK)); }
public void VerifyVersionCheckCtor() { var baseDalVersion = new JsonFileDal().DalVersion; Assert.DoesNotThrow( () => this.dal = new JsonFileDal(baseDalVersion)); Assert.DoesNotThrow( () => this.dal = new JsonFileDal(new Version($"{baseDalVersion.Major - 1}.{baseDalVersion.Minor}.{baseDalVersion.Build}"))); Assert.DoesNotThrow( () => this.dal = new JsonFileDal(new Version($"{baseDalVersion.Major}.{baseDalVersion.Minor - 1}.{baseDalVersion.Build}"))); Assert.Throws <DalVersionException>( () => this.dal = new JsonFileDal(new Version($"{baseDalVersion.Major + 1}.{baseDalVersion.Minor}.{baseDalVersion.Build}"))); Assert.Throws <DalVersionException>( () => this.dal = new JsonFileDal(new Version($"{baseDalVersion.Major}.{baseDalVersion.Minor + 1}.{baseDalVersion.Build}"))); Assert.Throws <DalVersionException>( () => this.dal = new JsonFileDal(new Version($"{baseDalVersion.Major}.{baseDalVersion.Minor}.{baseDalVersion.Build + 1}"))); }
public void TearDown() { this.credentials = null; this.dal = null; }