public void EntitiesNeedsService() { var messageBroker = A.Fake <IMessageBroker>(); A.CallTo(() => messageBroker.Show(Resources.MISSING_ORGANIZATION_SERVICE)).Returns(DialogResult.OK); var prototypesContainer = new PrototypesContainer(); prototypesContainer.InitializeBindings(new ToolViewModel { MessageBroker = messageBroker }); prototypesContainer.BtnEntities_Click(prototypesContainer, new EventArgs()); A.CallTo(() => messageBroker.Show(Resources.MISSING_ORGANIZATION_SERVICE)).MustHaveHappened(1, Times.Exactly); }
public void EntitiesNeedsService() { _context.AddFakeMessageExecutor <RetrieveAllEntitiesRequest>(new RetrieveAllEntitiesExecutor()); var managed = new EntityMetadata() { LogicalName = "albxrm_managed", SchemaName = "albxrm_Managed", IsCustomizable = new BooleanManagedProperty(false) }; managed.SetSealedPropertyValue(nameof(managed.IsManaged), true); _context.InitializeMetadata( new EntityMetadata[] { new EntityMetadata() { LogicalName = "albxrm_unittest", SchemaName = "albxrm_UnitTest", IsCustomizable = new BooleanManagedProperty(true) }, new EntityMetadata() { LogicalName = "albxrm_noncustomizable", SchemaName = "albxrm_NonCustomizable", IsCustomizable = new BooleanManagedProperty(false) }, managed }); var messageBroker = A.Fake <IMessageBroker>(); A.CallTo(() => messageBroker.Show(string.Format(Resources.UNMANAGED_ENTITIES, 1) + "\r\nalbxrm_UnitTest")).Returns(DialogResult.OK); var prototypesContainer = new PrototypesContainer(); prototypesContainer.InitializeBindings(new ToolViewModel { MessageBroker = messageBroker, OrganizationService = _service }); prototypesContainer.BtnEntities_Click(prototypesContainer, new EventArgs()); A.CallTo(() => messageBroker.Show(string.Format(Resources.UNMANAGED_ENTITIES, 1) + "\r\nalbxrm_UnitTest")).MustHaveHappened(1, Times.Exactly); }