public void TestSave() { var terminalSettings = new TerminalSettings { Command = Command, Arguments = Arguments }; var repositoryMock = new Mock <IRepository <TerminalSettings> >(); repositoryMock .Setup(m => m.Upsert(It.IsAny <string>(), terminalSettings)) .Verifiable(); var uowMock = new Mock <IUnitOfWork>(); uowMock .Setup(m => m.GetRepository <TerminalSettings>()) .Returns(repositoryMock.Object); var uowFactoryMock = new Mock <IUnitOfWorkFactory>(); uowFactoryMock .Setup(m => m.Create()) .Returns(uowMock.Object); var processServiceMock = new Mock <IProcessService>(); var terminalService = new TerminalService(processServiceMock.Object, uowFactoryMock.Object); terminalService.SetTerminalSettings(terminalSettings); repositoryMock.Verify(m => m.Upsert(It.IsAny <string>(), terminalSettings)); }