private void InitMockCategories() { var dateModified = DateTime.Parse("2015-02-19"); var googleCategoryId0 = 2; var googleNativeCategoryId0 = 1; var googleCategoryId1 = 3; var googleNativeCategoryId1 = 3237; this.googleCategory0 = new MockGoogleCategory { DateModified = dateModified, GoogleNativeCategoryId = googleNativeCategoryId0, Name = "Animals & Pet Supplies", ParentId = null, GoogleCategoryId = googleCategoryId0, BreadcrumbPath = "Animals & Pet Supplies", ChildrenExist = false, }; this.googleCategory1 = new MockGoogleCategory { DateModified = dateModified, GoogleNativeCategoryId = googleNativeCategoryId1, Name = "Live Animals", ParentId = googleCategory0.GoogleCategoryId, GoogleCategoryId = googleCategoryId1, BreadcrumbPath = googleCategory0.BreadcrumbPath + " > " + "Live Animals", ChildrenExist = true, }; }
public void Builder_UpdateDelete_Test() { // Assert this.SetupVerifyUpdate(); var categoryToDelete = new MockGoogleCategory { GoogleCategoryId = 1, BreadcrumbPath = "Category to delete", }; this.googleCategoryServiceMock.Setup(m => m.GetAllGoogleCategories()) .Returns(new[] { this.googleCategory0, categoryToDelete, this.googleCategory1 }); // Act this.builder.Build(null); // Assert this.googleCategoryServiceMock.Verify( m => m.Delete(It.Is <int>(id => id == categoryToDelete.GoogleCategoryId)), Times.Once()); this.googleCategoryServiceMock.Verify( m => m.Delete(It.Is <int>(id => id == googleCategory0.GoogleCategoryId)), Times.Never()); this.googleCategoryServiceMock.Verify( m => m.Delete(It.Is <int>(id => id == googleCategory1.GoogleCategoryId)), Times.Never()); }