Ejemplo n.º 1
0
        public void TestDelete()
        {
            // Arrange
            var            fakeHelper  = A.Fake <IFileHelper>();
            List <Contact> exampleList = new List <Contact>()
            {
                _rob,
                _joe,
                _mark
            };

            A.CallTo(() => fakeHelper.GetData <Contact>(A <string> .Ignored)).Returns(exampleList);
            A.CallTo(() => fakeHelper.SetData <Contact>(A <string> .Ignored, A <List <Contact> > .Ignored)).DoesNothing();



            var value = new ValuesController(fakeHelper);

            // Act
            value.DeleteEmployee("*****@*****.**");

            //Assert
            A.CallTo(() => fakeHelper.GetData <Contact>(A <string> .Ignored)).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeHelper.SetData <Contact>(A <string> .Ignored, A <List <Contact> > .That.Matches(x => x.Count == 2))).MustHaveHappened();
            A.CallTo(() => fakeHelper.SetData <Contact>(A <string> .Ignored, A <List <Contact> > .That.Matches(x => x.Any(f => f.email == "*****@*****.**") == false))).MustHaveHappened();
            Assert.Pass();
        }