public void SetPivot_DimensionNonExistant() { var ac = WhenIHaveA <AggregateConfiguration>(); var cmd = new ExecuteCommandSetPivot(GetMockActivator().Object, ac, "fff"); var ex = Assert.Throws <Exception>(() => cmd.Execute()); Assert.AreEqual("Could not find AggregateDimension fff in Aggregate My graph so could not set it as a pivot dimension. Try adding the column to the aggregate first", ex.Message); }
public void SetPivot_ExistsButIsADate() { var ac = WhenIHaveA <AggregateConfiguration>(); var dim = WhenIHaveA <AggregateDimension>(); dim.AggregateConfiguration_ID = ac.ID; dim.Alias = "frogmarch"; dim.ColumnInfo.Data_type = "datetime"; var cmd = new ExecuteCommandSetPivot(GetMockActivator().Object, ac, "frogmarch"); var ex = Assert.Throws <Exception>(() => cmd.Execute()); Assert.AreEqual("AggregateDimension frogmarch is a Date so cannot set it as a Pivot for Aggregate My graph", ex.Message); }
public void SetPivot_Exists() { var ac = WhenIHaveA <AggregateConfiguration>(); var dim = WhenIHaveA <AggregateDimension>(); dim.AggregateConfiguration_ID = ac.ID; dim.Alias = "frogmarch"; var cmd = new ExecuteCommandSetPivot(GetMockActivator().Object, ac, "frogmarch"); cmd.Execute(); Assert.AreEqual(dim.ID, ac.PivotOnDimensionID); cmd = new ExecuteCommandSetPivot(GetMockActivator().Object, ac, null); cmd.Execute(); Assert.IsNull(ac.PivotOnDimensionID); }