本文整理汇总了C#中Telerik.JustMock.PrivateAccessor类的典型用法代码示例。如果您正苦于以下问题:C# PrivateAccessor类的具体用法?C# PrivateAccessor怎么用?C# PrivateAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrivateAccessor类属于Telerik.JustMock命名空间,在下文中一共展示了PrivateAccessor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Execute_WhenCalledWithEmptyList_Throw
public void Execute_WhenCalledWithEmptyList_Throw()
{
var rule = new ChecklistDisplayFieldsShouldBeUniqueRule(ChecklistFieldsStepEdit.DisplayFieldsProperty);
var context = Mock.Create<RuleContext>(Constructor.Mocked, Behavior.CallOriginal);
var mock1 = Mock.Create<ChecklistDisplayFieldEdit>();
Mock.Arrange(() => mock1.SystemName).Returns("s1");
var mock2 = Mock.Create<ChecklistDisplayFieldEdit>();
Mock.Arrange(() => mock2.SystemName).Returns("s1");
var list = new List<ChecklistDisplayFieldEdit>{mock1, mock2};
Mock.Arrange(() => context.InputPropertyValues).Returns(new Dictionary<IPropertyInfo, object> { { ChecklistFieldsStepEdit.DisplayFieldsProperty, list }});
var checklistFieldsStepEditMock = Mock.Create<ChecklistFieldsStepEdit>();
Mock.Arrange(() => checklistFieldsStepEditMock.GetParent<FieldEdit>()).Returns(new FieldEdit());
Mock.Arrange(() => context.Target).Returns(checklistFieldsStepEditMock);
var ruleWasThrown = false;
Mock.Arrange(() => context.AddErrorResult(Arg.AnyString)).DoInstead(() => ruleWasThrown = true);
// act
var privateAccessor = new PrivateAccessor(rule);
privateAccessor.CallMethod("Execute", new object[] { context });
//Assert
Assert.IsTrue(ruleWasThrown);
}
开发者ID:mparsin,项目名称:Elements,代码行数:28,代码来源:ChecklistDisplayFieldsShouldBeUniqueRuleTests.cs
示例2: Execute
public void Execute()
{
// arrange
var rule = new ScheduleFrequencyPatternRule(null, null);
var context = Mock.Create<RuleContext>(Constructor.Mocked, Behavior.CallOriginal);
Mock.Arrange(() => context.InputPropertyValues)
.Returns(new Dictionary<IPropertyInfo, object> { { ProcessScheduleEdit.HighlightScheduleFrequencyPatternProperty, 0 }, { ProcessScheduleEdit.ScheduleFrequencyPatternIdProperty, 0 } });
var ruleWasThrown = false;
Mock.Arrange(() => context.AddErrorResult(Arg.IsAny<IPropertyInfo>(), Arg.AnyString)).DoInstead(() => ruleWasThrown = true);
// act
var privateAccessor = new PrivateAccessor(rule);
privateAccessor.CallMethod("Execute", new object[] { context });
// assert
Assert.IsTrue(ruleWasThrown);
// arrange
ruleWasThrown = false;
Mock.Arrange(() => context.InputPropertyValues)
.Returns(new Dictionary<IPropertyInfo, object> { { ProcessScheduleEdit.HighlightScheduleFrequencyPatternProperty, 0 }, { ProcessScheduleEdit.ScheduleFrequencyPatternIdProperty, 1 } });
// act
privateAccessor.CallMethod("Execute", new object[] { context });
// assert
Assert.IsFalse(ruleWasThrown);
}
开发者ID:mparsin,项目名称:Elements,代码行数:30,代码来源:ScheduleFrequencyPatternRuleTests.cs
示例3: TestOnStepAsyncAtCancel
public void TestOnStepAsyncAtCancel()
{
GeneralThreadAffineContext.Run(
async () =>
{
Mock.Arrange(() => Application.Current.Dispatcher.InvokeAsync(null))
.IgnoreArguments()
.DoNothing();
var managementMock = Mock.Create<CollectionsManagementViewModel>(Behavior.CallOriginal);
var editQueueMock = Mock.Create<EditQueueViewModel>(
Behavior.CallOriginal, managementMock);
Mock.NonPublic.Arrange<Task>(editQueueMock, "UnLockAsync").Returns(Task.Run(() => { }));
Mock.Arrange(() => editQueueMock.SelectedQueue).Returns(new QueueDetailsModel());
Mock.Arrange(
() => managementMock.OnStepAsync(CollectionsManagementViewModel.EnumSteps.SelectQueue))
.Returns(Task.Run(() => { }));
var mainView = new PrivateAccessor(editQueueMock);
mainView.SetProperty("IsCheckedOut", true);
await editQueueMock.OnStepAsync(EditQueueViewModel.EnumSteps.Cancel);
bool isCheckedOutOnMainViewModel = mainView.GetProperty("IsCheckedOut") is bool && (bool)mainView.GetProperty("IsCheckedOut");
Assert.IsFalse(isCheckedOutOnMainViewModel);
});
}
开发者ID:tuanva90,项目名称:mvccodefirst,代码行数:28,代码来源:EditQueueUnitTest.cs
示例4: CheckPropertiesInitialValuesTest
public void CheckPropertiesInitialValuesTest()
{
//Mock spreadsheet
var spreadsheetMock = Mock.Create<SpreadsheetView>(Constructor.Mocked, Behavior.Loose);
Mock.Arrange(() => spreadsheetMock.GetTopLevelSpreadsheet()).CallOriginal();
//Call constructor
var container = new SpreadsheetItemContainer(spreadsheetMock);
var privateAccessor = new PrivateAccessor(container);
//Assert fields
Assert.IsNotNull(privateAccessor.GetField("_topLevelSpreadsheet"));
Assert.AreEqual(privateAccessor.GetField("_topLevelSpreadsheet"), spreadsheetMock);
Assert.IsNotNull(privateAccessor.GetField("_owner"));
Assert.AreEqual(privateAccessor.GetField("_owner"), spreadsheetMock);
Assert.IsNull(privateAccessor.GetField("_item"));
Assert.IsFalse((bool)privateAccessor.GetField("_disposed"));
//Assert properties
Assert.IsFalse(container.IsOdd);
Assert.IsFalse(container.IsDisposed);
Assert.AreEqual(container.Owner, spreadsheetMock);
Assert.AreEqual(container.TopLevelSpreadsheet, spreadsheetMock);
Assert.IsNull(container.Item);
Assert.IsNotNull(container.Cells);
Assert.IsFalse(container.Cells.Any());
Assert.IsFalse(container.IsAlternate);
Assert.IsFalse(container.IsSelected);
}
开发者ID:mparsin,项目名称:Elements,代码行数:29,代码来源:SpreadsheetItemContainerTests.cs
示例5: CanSortOrGroupLayout
public void CanSortOrGroupLayout()
{
// arrange
var vm = new ProcessLayoutsViewModel();
var model = Mock.Create<ProcessEdit>(Behavior.Loose);
model.SystemName = Constants.CalendarProcessName;
Mock.Arrange(() => vm.Model).Returns(model);
// act
var privateAccessor = new PrivateAccessor(vm);
var result = (bool)privateAccessor.CallMethod("CanSortOrGroupLayout", new object[] { null });
// assert
Assert.IsFalse(result);
// arrage
model.SystemName = "eCar_p";
// act
result = (bool)privateAccessor.CallMethod("CanSortOrGroupLayout", new object[] { null });
// assert
Assert.IsTrue(result);
}
开发者ID:mparsin,项目名称:Elements,代码行数:26,代码来源:ProcessLayoutsViewModelTests.cs
示例6: Ctor
public void Ctor()
{
// arrange
Mock.SetupStatic(typeof(Ioc));
// act
var handler = new DocHandler();
// assert
var privateAccessor = new PrivateAccessor(handler);
Assert.IsNull(privateAccessor.GetField("_fileProcessorUri"));
Assert.IsNull(privateAccessor.GetField("_tempDocumentUnc"));
// arrange
Mock.Arrange(() => SystemOptionsInfo.GetSystemOptionsInfo()).Returns(new SystemOptionsInfo
{
FileProcessorURI = "http://localhost:5556/DocumentProcessor.ashx",
TempDocumentUNC = @"D:\Projects\Cebos\release-2.2\Cebos.Veyron.Web\FileStorage"
});
// act
handler = new DocHandler();
// assert
privateAccessor = new PrivateAccessor(handler);
Assert.AreEqual("http://localhost:5556/DocumentProcessor.ashx", privateAccessor.GetField("_fileProcessorUri"));
Assert.AreEqual(@"D:\Projects\Cebos\release-2.2\Cebos.Veyron.Web\FileStorage", privateAccessor.GetField("_tempDocumentUnc"));
}
开发者ID:mparsin,项目名称:Elements,代码行数:28,代码来源:DocHandlerTests.cs
示例7: WhenCalledConvert_CreatesNewViewOrReturnsCachedOneIfAny
public void WhenCalledConvert_CreatesNewViewOrReturnsCachedOneIfAny()
{
var converter = new EditorSelector();
var privateAccessor = new PrivateAccessor(converter);
EditorSelector.ResetComposedConverter();
var view = new UserControl();
const string fieldType = "testFieldType";
converter.EditorFactories = new[]
{
new ExportFactory<UserControl, IExportAsControlForTypeMetadata>(
() => new Tuple<UserControl, Action>(view, () => { }),
new ExportAsControlForTypeAttribute(fieldType))
};
var fieldItemMock = Mock.Create<IFieldItem>(Behavior.CallOriginal);
Mock.Arrange(() => fieldItemMock.FieldType).Returns(fieldType);
Mock.Arrange(() => fieldItemMock.CanEdit).Returns(true);
Mock.Arrange(() => fieldItemMock.CanView()).Returns(true);
Mock.Arrange(() => fieldItemMock.IsInformationOnly).Returns(false);
var returnedView = (UserControl)converter.Convert(fieldItemMock, new TypeDelegator(typeof (object)), new object(), null);
Assert.AreEqual(view.GetType(), returnedView.GetType());
Assert.AreSame(fieldItemMock, returnedView.DataContext);
Assert.IsTrue(returnedView.IsEnabled);
//check that view was cached in RegisteredViews table
UserControl cachedView;
var registeredViews = privateAccessor.GetField("RegisteredViews") as ConditionalWeakTable<IFieldItem, UserControl>;
Assert.IsNotNull(registeredViews);
Assert.IsTrue(registeredViews.TryGetValue(fieldItemMock, out cachedView));
//remove cached view to ensure that converter will create a new one
registeredViews.Remove(fieldItemMock);
Mock.Arrange(() => fieldItemMock.CanEdit).Returns(false);
Mock.Arrange(() => fieldItemMock.CanView()).Returns(false);
returnedView = (UserControl)converter.Convert(fieldItemMock, new TypeDelegator(typeof(object)), new object(), null);
Assert.AreEqual(view.GetType(), returnedView.GetType());
Assert.AreSame(fieldItemMock, returnedView.DataContext);
Assert.IsFalse(returnedView.IsEnabled);
//now converter should return the cached view
Mock.Arrange(() => fieldItemMock.CanEdit).Returns(true);
Mock.Arrange(() => fieldItemMock.CanView()).Returns(true);
var returnedCachedView = (UserControl)converter.Convert(fieldItemMock, new TypeDelegator(typeof(object)), new object(), null);
Assert.IsTrue(ReferenceEquals(returnedView, returnedCachedView));
Assert.AreSame(fieldItemMock, returnedCachedView.DataContext);
Assert.IsFalse(returnedCachedView.IsEnabled);
}
开发者ID:mparsin,项目名称:Elements,代码行数:58,代码来源:EditorSelectorTest.cs
示例8: PrivateAccessor_ShouldCallPrivateMethod
public void PrivateAccessor_ShouldCallPrivateMethod()
{
// ACT
// Wrapping the instance holding the private method.
var inst = new PrivateAccessor(new ClassWithNonPublicMembers());
// Calling the non-public method by giving its exact name.
var actual = inst.CallMethod("MePrivate");
// ASSERT
Assert.AreEqual(1000, actual);
}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:11,代码来源:PrivateAccessor.cs
示例9: IsDeletingCommand
public void IsDeletingCommand()
{
// arrange
var command = Mock.Create<InsertImageToRichtextCommand>(Constructor.Mocked, Behavior.CallOriginal);
// act
var result = new PrivateAccessor(command).GetProperty("IsDeletingCommand");
// assert
Assert.IsTrue((bool)result);
}
开发者ID:mparsin,项目名称:Elements,代码行数:11,代码来源:InsertImageToRichtextCommandTests.cs
示例10: PrivateAccessor_ShouldGetSetProperty
public void PrivateAccessor_ShouldGetSetProperty()
{
// ACT
// Wrapping the instance holding the private property.
var inst = new PrivateAccessor(new ClassWithNonPublicMembers());
// Setting the value of the private property.
inst.SetProperty("Prop", 555);
// ASSERT - Asserting with getting the value of the private property.
Assert.AreEqual(555, inst.GetProperty("Prop"));
}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:11,代码来源:PrivateAccessor.cs
示例11: OnMouseLeftButtonUp_NodesShouldBeConnectedFromSourceToDestination
public void OnMouseLeftButtonUp_NodesShouldBeConnectedFromSourceToDestination()
{
var thumbMock = Mock.Create<ConnectorThumb>(Constructor.Mocked);
var privateAccessor = new PrivateAccessor(thumbMock);
//Arrange
Mock.NonPublic.Arrange(thumbMock, "OnMouseLeftButtonUp", ArgExpr.IsAny<MouseButtonEventArgs>()).CallOriginal();
var dcMock = Mock.Create<ExpressionConnectorViewModel>();
Mock.Arrange(() => dcMock.ConnectorType).Returns(ConnectorType.In);
Mock.Arrange(() => dcMock.Item.CreateConnection(Arg.IsAny<IDiagramItem>(), Arg.IsAny<IDiagramItem>()))
.Returns(Mock.Create<ExpressionConnection>(Constructor.Mocked, Behavior.Loose));
Mock.Arrange(() => thumbMock.DataContext).Returns(dcMock);
var panelMock = Mock.Create<DiagramPanel>(Constructor.Mocked);
Mock.Arrange(() => DiagramPanel.GetParentPanel<DiagramPanel>(thumbMock)).Returns(panelMock);
var panelDcMock = Mock.Create<DiagramViewModel>();
Mock.Arrange(() => panelDcMock.Items).Returns(new Collection<IDiagramItemViewModel>());
Mock.Arrange(() => panelMock.DataContext).Returns(panelDcMock);
var connectionEndMock = Mock.Create<ExpressionConnectorViewModel>();
Mock.Arrange(() => connectionEndMock.CreateConnectionTo(Arg.IsAny<IDiagramItemViewModel>())).CallOriginal();
Mock.Arrange(() => connectionEndMock.CanConnectTo(Arg.IsAny<IDiagramItemViewModel>(), Arg.IsAny<ICollection<IDiagramItemViewModel>>())).Returns(ConnectivityState.Allow);
Mock.Arrange(() => panelMock.GetViewModelByLocation<IDiagramItemViewModel>(Arg.IsAny<Point>())).Returns(connectionEndMock);
privateAccessor.SetField("_isDragging", true);
//Act
privateAccessor.CallMethod("OnMouseLeftButtonUp", Mock.Create<MouseButtonEventArgs>());
//Assert
IConnectionViewModel newConnection = null;
try
{
newConnection = panelDcMock.Items.ToList()[0] as IConnectionViewModel;
}
catch (Exception)
{
Assert.Fail("No connections where created");
return;
}
Assert.AreEqual(1, panelDcMock.Items.Count);
if (newConnection != null)
{
Assert.AreEqual(connectionEndMock, newConnection.Source);
Assert.AreEqual(dcMock, newConnection.Destination);
}
else
Assert.Fail("Type of the object does not inherit IConnectionViewModel");
}
开发者ID:mparsin,项目名称:Elements,代码行数:54,代码来源:ConnectorThumbTests.cs
示例12: GetTitleTests
public void GetTitleTests()
{
// arrange
var vm = NewAccountListViewModel();
// act
var privateAccessor = new PrivateAccessor(vm);
var result = privateAccessor.CallMethod("GetTitle");
// assert
Assert.AreEqual("Account Management", result);
}
开发者ID:mparsin,项目名称:Elements,代码行数:12,代码来源:AccountListViewModelTests.cs
示例13: Child_Update_test
public void Child_Update_test()
{
// Arrange
var mockedClass = Mock.Create<ConnectionSetupEdit>(Behavior.CallOriginal);
var setup = Mock.Create<IConnectionsSetupDAL>();
Mock.Arrange(() => setup.UpdateConnectionSetup(Arg.IsAny<ConnectionSettingsDto>())).DoNothing();
Mock.Arrange(() => mockedClass.ConnectionsSetupDAL).Returns(setup);
// Act
var inst = new PrivateAccessor(mockedClass);
inst.CallMethod("Child_Update");
}
开发者ID:mparsin,项目名称:Elements,代码行数:12,代码来源:ConnectionSetupEditTest.cs
示例14: TestFieldDefaultValues
public void TestFieldDefaultValues()
{
var vm = new GageRRFieldViewModel();
var privateAccessor = new PrivateAccessor(vm);
Assert.IsNull(privateAccessor.GetField("_detailsViewModel"));
Assert.IsNull(privateAccessor.GetField("_settingsPropertyName"));
Assert.IsNull(privateAccessor.GetField("_sourceProcessName"));
Assert.IsNull(privateAccessor.GetField("_msaResults"));
Assert.IsNull(privateAccessor.GetField("_dataGroupingItem"));
Assert.IsNull(privateAccessor.GetField("_showItemSelectorCommand"));
}
开发者ID:mparsin,项目名称:Elements,代码行数:13,代码来源:GageRRFieldViewModelTests.cs
示例15: TestFunctionGetCategoryTask
public void TestFunctionGetCategoryTask()
{
Mock.Arrange(() => Application.Current.Dispatcher.InvokeAsync(null))
.IgnoreArguments().DoNothing();
var viewModel = Mock.Create<QueueNoteTaskViewModel>(Behavior.CallOriginal);
Mock.Arrange(() => QueueAssignmentFunctions.GetCategoryTaskActivity())
.Returns(FakeData.FakeSelectList());
Mock.SetupStatic(typeof(CollectionsQueueSettingsFunctions), StaticConstructor.Mocked);
Mock.Arrange(() => CollectionsQueueSettingsFunctions.ReadCollectionSystemDefaultAsync())
.Returns(FakeData.FakesCollectionDefault());
var inst = new PrivateAccessor(viewModel);
inst.CallMethod("GetCategoryTask");
Assert.IsNotNull(viewModel.ListCategory);
}
开发者ID:tuanva90,项目名称:mvccodefirst,代码行数:14,代码来源:QueueNoteTaskUnitTest.cs
示例16: ConstructorTest
public void ConstructorTest()
{
var stepEditMock = Mock.Create<GageRROptionsStepEdit>(Constructor.Mocked, Behavior.Loose);
stepEditMock.SampleFilterDefinition = "FilterDefinition";
var vm = new GageRROptionsStepViewModel(stepEditMock, null, null);
Assert.IsNotNull(vm.AvailableProcesses);
Assert.IsNotNull(vm.SelectedProcessAvailableFields);
Assert.IsNotNull(vm.AnswerProcessAvailableFields);
Assert.AreEqual(vm.FilterDefinition, "FilterDefinition");
var privateAccessor = new PrivateAccessor(vm);
Assert.IsTrue((bool)privateAccessor.GetField("_isLoading"));
}
开发者ID:mparsin,项目名称:Elements,代码行数:14,代码来源:GageRROptionsStepViewModelTests.cs
示例17: IsDropDownOpen_WhenSetToTrue_CreatesSelectorView
public void IsDropDownOpen_WhenSetToTrue_CreatesSelectorView()
{
//Arrange
var crossRef = new FieldSingleCrossRef();
//Act
crossRef.IsDropDownOpen = true;
//Assert
var inst = new PrivateAccessor(crossRef);
var d = inst.GetField("selectorView");
Assert.IsNotNull(d);
}
开发者ID:mparsin,项目名称:Elements,代码行数:14,代码来源:FieldSingleCrossRefTests.cs
示例18: AssignItemsSourceFirstTest
public void AssignItemsSourceFirstTest()
{
var spreadsheet = new SpreadsheetView();
var spreadsheetData = new List<TestData>
{
new TestData{Text = "string1", FractionalNumber = 10.0},
new TestData{Text = "string2", FractionalNumber = 20.0},
new TestData{Text = "test text", FractionalNumber = 30.2}
};
var privateAccessor = new PrivateAccessor(spreadsheet);
//By default ItemsSource of SpreadsheetView is null
Assert.IsNull(spreadsheet.ItemsSource);
Mock.NonPublic.Arrange<SpreadsheetView>("OnItemsSourceChanged", ArgExpr.IsAny<DependencyObject>(), ArgExpr.IsAny<DependencyPropertyChangedEventArgs>())
.CallOriginal()
.MustBeCalled();
spreadsheet.ItemsSource = spreadsheetData;
Assert.AreEqual(spreadsheet.ItemsSource, spreadsheetData);
Mock.NonPublic.Assert<SpreadsheetView>("OnItemsSourceChanged", ArgExpr.IsAny<DependencyObject>(), ArgExpr.IsAny<DependencyPropertyChangedEventArgs>());
//FillItemsSource must be called from OnApplyTemplate if it hasn't been invoked yet
Mock.NonPublic.Assert(spreadsheet, "FillItemsSource", Occurs.Never(), ArgExpr.IsAny<IEnumerable>());
Assert.IsFalse((bool)privateAccessor.GetField("_templateApplied"));
//We've set SpreadsheetView.ItemsSource but ItemsControl.ItemsSource is still null
var itemsControl = spreadsheet as ItemsControl;
Assert.IsNull(itemsControl.ItemsSource);
//Invoke OnApplyTemplate manually
spreadsheet.OnApplyTemplate();
Mock.NonPublic.Assert(spreadsheet, "FillItemsSource", Occurs.Once(), ArgExpr.IsAny<IEnumerable>());
Assert.IsTrue((bool)privateAccessor.GetField("_templateApplied"));
//FillItemsSource calls PopulateColumns
Mock.NonPublic.Assert(spreadsheet, "PopulateColumns", Occurs.Once(), ArgExpr.IsAny<SpreadsheetElementCollection>());
//Now ItemsControl.ItemsSource has value as well
Assert.IsNotNull(itemsControl.ItemsSource);
Assert.AreEqual(itemsControl.ItemsSource.GetType(), typeof(SpreadsheetElementCollection));
//SpreadsheetView.ItemsCollection has only getter which retrieves data from ItemsControl.ItemsSource and casts it to SpreadsheetElementCollection
Assert.AreEqual(itemsControl.ItemsSource, spreadsheet.ItemsCollection);
//Assure that all our elements are there
Assert.AreEqual(((IList)spreadsheet.ItemsSource).Count, spreadsheetData.Count);
Assert.AreEqual(((IList)itemsControl.ItemsSource).Count, spreadsheetData.Count);
}
开发者ID:mparsin,项目名称:Elements,代码行数:49,代码来源:SpreadsheetViewTests.cs
示例19: Execute
public void Execute()
{
// arrange
var rule = new RichTextMaxLengthRule(null, 0);
var privateAccessor = new PrivateAccessor(rule);
// act
try
{
privateAccessor.CallMethod("Execute", new object[] { null });
}
catch (Exception ex)
{
// assert
Assert.Fail("Expected no exception, but got: " + ex.Message);
}
// arrange
var property = Mock.Create<IPropertyInfo>(Behavior.RecursiveLoose);
var context = Mock.Create<RuleContext>(Constructor.Mocked, Behavior.CallOriginal);
Mock.Arrange(() => context.InputPropertyValues).Returns(new Dictionary<IPropertyInfo, object>
{
{ property, string.Empty }
});
rule.PrimaryProperty = property;
var ruleWasThrown = false;
Mock.Arrange(() => context.AddErrorResult(Arg.IsAny<IPropertyInfo>(), Arg.AnyString)).DoInstead(() => ruleWasThrown = true);
// act
privateAccessor.CallMethod("Execute", new object[] { context });
// assert
Assert.IsFalse(ruleWasThrown);
// arrange
Mock.Arrange(() => context.InputPropertyValues).Returns(new Dictionary<IPropertyInfo, object>
{
{ property, "Hello World!" + Constants.InvokeRichTextMaxLengthRule }
});
// act
privateAccessor.CallMethod("Execute", new object[] { context });
// assert
Assert.IsTrue(ruleWasThrown);
}
开发者ID:mparsin,项目名称:Elements,代码行数:49,代码来源:RichTextMaxLengthRuleTests.cs
示例20: InvokeConstructorTest
public void InvokeConstructorTest()
{
//Mock spreadsheet
var spreadsheetMock = Mock.Create<SpreadsheetView>(Constructor.Mocked, Behavior.Loose);
Mock.Arrange(() => spreadsheetMock.GetTopLevelSpreadsheet()).CallOriginal();
//Call constructor
var container = new SpreadsheetItemContainer(spreadsheetMock);
var privateAccessor = new PrivateAccessor(container);
//Assert fields and properties
Assert.AreEqual(privateAccessor.GetField("_owner"), spreadsheetMock);
Assert.AreEqual(container.TopLevelSpreadsheet, spreadsheetMock);
Assert.IsNotNull(container.Cells);
}
开发者ID:mparsin,项目名称:Elements,代码行数:15,代码来源:SpreadsheetItemContainerTests.cs
注:本文中的Telerik.JustMock.PrivateAccessor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论