public static void AreEqual(Package package1, Package package2,bool includeOptionalFields = false) { if (package1 == null) { throw new ArgumentNullException("package1"); } if (package2 == null) { throw new ArgumentNullException("package2"); } if (includeOptionalFields) { Assert.AreEqual(package1.Id, package2.Id); Assert.AreEqual(package1.DateCreated, package2.DateCreated); } Assert.AreEqual(package1.Name, package2.Name); Assert.AreEqual(package1.PackageLocation, package2.PackageLocation); Assert.AreEqual(package1.PackageManifest, package2.PackageManifest); Assert.AreEqual(package1.PackageType, package2.PackageType); Assert.AreEqual(package1.Version, package2.Version); string package1Tags = string.Empty; string package2Tags = string.Empty; if (package1.Tags != null) { package1Tags = CustomAssert.ConvertTagsToString(package1.Tags); } if (package2.Tags != null) { package2Tags = CustomAssert.ConvertTagsToString(package2.Tags); } }
public Package AddPackage(Package package) { if (package == null) { throw new ArgumentNullException("package"); } package.DateCreated = DateTime.Now; var result = this.PackagesCollection.Insert<Package>(package); return package; }
public static void AreEqual(Package package, PackagePageModel packagePageModel) { if (package == null) { throw new ArgumentNullException("package"); } if (packagePageModel == null) { throw new ArgumentNullException("packagePageModel"); } Assert.AreEqual(package.Id, packagePageModel.Id); Assert.AreEqual(package.Name, packagePageModel.Name); Assert.AreEqual(package.PackageLocation, packagePageModel.PackageLocation); Assert.AreEqual(packagePageModel.PackageManifest, packagePageModel.PackageManifest); Assert.AreEqual(package.Version, packagePageModel.Version); string tagString = CustomAssert.ConvertTagsToString(package.Tags); Assert.AreEqual(packagePageModel.Tags.Replace(" ", string.Empty), tagString); }
public Package AddPackage(Package package) { if (package == null) { throw new ArgumentNullException("package"); } using (var session = this.DocStore.OpenSession()) { session.Store(package); session.SaveChanges(); } return package; }