public async Task GetAllCommandGetsAllFromUmbracoApi() { var service = Substitute.For <IContentTypeService>(); service.GetAllContentTypes().Returns(_ => Enumerable.Empty <IContentType>()); var deliverable = new ContentTypeDeliverable( null, Substitute.ForPartsOf <TextWriter>(), service, null, null, null, null ); await deliverable.Run("", new[] { "get-all" }); service.Received().GetAllContentTypes(); }
public async Task GetCommandWithAliasReturnsItemFromUmbracoApi() { var service = Substitute.For <IContentTypeService>(); service.GetContentType(Arg.Any <string>()).Returns(Substitute.For <IContentType>()); var deliverable = new ContentTypeDeliverable( null, Substitute.For <TextWriter>(), service, null, null, null, null ); await deliverable.Run("", new[] { "get", "alias" }); service.Received().GetContentType(Arg.Any <string>()); }
public async Task RemoveCommandWillCallRemoveMethod() { var service = Substitute.For <IContentTypeService>(); service.GetContentType(Arg.Any <string>()).Returns(Substitute.For <IContentType>()); service.Delete(Arg.Any <IContentType>()); var deliverable = new ContentTypeDeliverable( null, Substitute.For <TextWriter>(), service, null, null, null, null ); await deliverable.Run("", new[] { "remove", "alias" }); service.Received().Delete(Arg.Any <IContentType>()); }
public async Task RemovePropertyCommandWillRemoveAndSaveContentType() { var service = Substitute.For <IContentTypeService>(); var ct = Substitute.For <IContentType>(); service.GetContentType(Arg.Any <string>()).Returns(ct); service.Save(Arg.Any <IContentType>()); var deliverable = new ContentTypeDeliverable( null, Substitute.For <TextWriter>(), service, null, null, null, null ); await deliverable.Run("", new[] { "remove-property", "alias", "property-alias" }); ct.Received(1).RemovePropertyType(Arg.Any <string>()); service.Received(1).Save(Arg.Is(ct)); }