Exemplo n.º 1
0
		public void ShouldAssertThatReportIsSent()
		{
			var container = new MockingContainer<Reporter>();

			container.Arrange<IReportBuilder>(rb => rb.GetReports()).Returns(new[] { new Report(), new Report() });
			container.Arrange<IReportSender>(rs => rs.SendReport(Arg.IsAny<Report>())).Occurs(2);

			container.Instance.SendReports();

			container.AssertAll();
		}
Exemplo n.º 2
0
        public void ShouldAssertAllContainerArrangments()
        {
            // ARRANGE
            // Creating a MockingContainer of ClassUnderTest.
            // To instantiate the system uder test (the container) you should use the Instance property
            // For example: container.Instance.
            var container = new MockingContainer <ClassUnderTest>();

            // Arranging: That the GetString() method from the ISecondDependecy interface
            //              must be called from the container instance durring the test method.
            container.Arrange <ISecondDependency>(
                secondDep => secondDep.GetString()).MustBeCalled();

            // ACT - Calling SringMethod() from the mocked instance of ClassUnderTest
            var actualString = container.Instance.StringMethod();

            // ASSERT - Asserting all expectations for the container.
            container.AssertAll();
        }
Exemplo n.º 3
0
        public void ShouldAssertAllContainerArrangments()
        {
            // ARRANGE
            // Creating a MockingContainer of ClassUnderTest. 
            // To instantiate the system uder test (the container) you should use the Instance property 
            // For example: container.Instance. 
            var container = new MockingContainer<ClassUnderTest>();
             
            // Arranging: That the GetString() method from the ISecondDependecy interface 
            //              must be called from the container instance durring the test method. 
            container.Arrange<ISecondDependency>(
               secondDep => secondDep.GetString()).MustBeCalled();

            // ACT - Calling SringMethod() from the mocked instance of ClassUnderTest
            var actualString = container.Instance.StringMethod();

            // ASSERT - Asserting all expectations for the container.
            container.AssertAll();
        }